To run the example project, clone the repo, and run pod install
from the Example directory first.
MAIN |
---|
CONFIG |
---|
- Default Style form config.plist
NavBarAppearance.active()
- Custom with code
var navBuilder = NavBarBuilder.default
navBuilder.backgroundColor = UIColor.th.rgb(39, 168, 242)
navBuilder.buttonTextColor = UIColor.th.rgb(252, 30, 112)
navBuilder.titleColor = .red
navBuilder.titleFont = UIFont(name: "Copperplate", size: 18)!
navBuilder.isTranslucent = false
navBuilder.showSeparator = false
NavBarAppearance.active(navBuilder)
- Set color in viewcontroller
self.th.setNavBarBackgroundColor(color)
self.th.setNavSubViewColor(color)
self.th.reloadNavSubViewColor()//reload to config plist define
- Default style form config.plist
TabBarAppearance.active()
- Custom with code
var tabBuilder = TabBarBuilder.default
tabBuilder.backgroundColor = UIColor.th.rgb(39, 40, 34)
tabBuilder.selectedColor = UIColor.th.rgb(230, 220, 109)
tabBuilder.normalColor = .cyan
tabBuilder.font = UIFont(name: "Bradley Hand", size: 12)
tabBuilder.isTranslucent = false
tabBuilder.showSeparator = false
TabBarAppearance.active(tabBuilder)
- Set backgroundColor in viewcontroller
self.th.setTabBarBackgroundColor(color)
UIColor.th.tint
UIColor.th.subTint
UIColor.th.background
UIColor.th.title
UIColor.th.body
UIColor.th.subBody
UIColor.th.mark1
UIColor.th.mark2
UIColor.th.border
UIColor.th.empty
UIColor.th.random
UIColor.th.rgb(100, 200, 40)
UIColor.th.hexStr("#CCCCCC")
UIFont.th.title()
UIFont.th.body()
UIFont.th.mark()
UIFont.th.title(size: 30)
UIFont.th.title(fix: -2)
UIFont.th.body(size: 12)
UIFont.th.body(fix: 1)
UIFont.th.font(.title, size: 20)
UIFont.th.pfFont(.medium, size: 20)
UIFont.th.bodyFontSize
UIFont.th.bodyFontName
- Add NavBarButton
self.th.addNavBarButton(iconFontTexts: ["\u{e673}", "\u{e673}"], at: .left, iconFont: UIFont.init(name: "iconfont", size: 22)!, color: UIColor.cyan)
self.th.addNavBarButton(texts: ["Next"], at: .right)
self.th.addNavBarButton(images: ["image1", "image2"], at: .right, useOriginalColor: false)
self.th.clearNavBarBackButtonTitle()
self.th.addNavBarButtonItems(customView: view, at: .left)
override func rightBarButtonAction(index: Int) {
let vc = UIViewController()
vc.view.backgroundColor = UIColor.th.background
navigationController?.pushViewController(vc, animated: true)
}
override func leftBarButtonAction(index: Int) {
print("🐌 iconfont index: \(index)")
}
- KerboardNotification
self.th.addKeyboardNotification()
self.th.removeKeyboardNotification()
override func keyboardWillShow(duration dt: Double, userInfo: Dictionary<String, Any>) {
UIView.animate(withDuration: dt) {
}
}
override func keyboardWillChangeFrame(beginRect: CGRect, endRect: CGRect, duration dt: Double, userInfo: Dictionary<String, Any>) {
UIView.animate(withDuration: dt) {
v.bottom = endRect.height
}
}
override func keyboardWillHide(duration dt: Double, userInfo: Dictionary<String, Any>) {
UIView.animate(withDuration: dt) {
}
}
UIAlertController.th.showAlert(...)
UIAlertController.th.showActionSheet(...)
UITableViewCell.th.reuseIdentifier
THTableViewCell.th.nibName
let attr = NSAttributedString.th.string(...)
attr.th.setColor(...)
attr.th.setFont(...)
view.th.corners(.left)
view.th.corners(.right)
view.th.corners(.forwardSlash)
...
str.th.noticename //NSNotification.Name
str.th.currencyString(...)
str.th.attributedCurrencyStr(...)
...
UIDevice.th.width
UIDevice.th.height
UIDevice.th.isXSeries
UIDevice.th.topBarHeight
UIDevice.th.bottomBarHeight
...
...
extension Thin where Base: [ClassType] {
static func
func
}
extension Thin where Base == [StructType] {
static func
func
}
Thin is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ThinX'
Felix, hulj1204@yahoo.com
Thin is available under the MIT license. See the LICENSE file for more info.