测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可 | MIT |
Released最后发布 | 2017年12月 |
SwiftSwift 版本 | 4.0 |
SPM支持 SPM | ✗ |
由 AndreaBellotto 维护。
这个库通过扩展标准类和类型,为您提供一些有用的变量和函数。
Locale.italy // returns Locale with string "it-IT"
Locale.usa // returns Locale with string "en-US"
2.123131.round(fractionDigits:2) // output: 2.12
let price:Double = 100.00
print(price.format(with: .italy, and: .currencyISOCode)) // prints 100.00 EUR
"alert_message".localized // output: whatever you have in your .strings file at alert_message string
" hello world".trimmed // output: hello world
UIApplication.toppestViewController()
UIColor(r:200, g:200, b:200)
self.navigationItem.addDismissLeftButton(target: self, selector: #selector(...), image:UIImage(named:"asd"), scale: 10)
self.tableView.isScrolledToBottom // output: true or false
self.tableView.scrollToBottom(animated:true)
self.tableView.register(CustomTableViewCell.self)
textField.placeholderColor = UIColor.red
TestViewController.nameIdentifier // output: "TestViewController"
self.present(viewControllerToPresent: vc, animated: true, embedInNavigationController: true, completion: nil)
MyCustomView.nameIdentifier // output: "MyCustomView"
MyCustomView.loadViewFromNib()
如果在 IBDesignable 类的 initWithCoder
和 initWithFrame
函数中调用 setup()
,您可以在 storyboard 中看到您自定义的 UIView
@IBDesignable
class CustomLabel: UIView {
override init(frame: CGRect)
{
super.init(frame: frame)
setup()
}
required init(coder aDecoder: NSCoder)
{
super.init(coder: aDecoder)!
setup()
}
}
myView.change(topConstraint, constantWith:20.0, andAnimating:true)
myView.fadeIn(withAnimation:true)
myView.fadeOut(withAnimation:true)
myView.fade(withAnimation:true)
let constraints:[NSLayoutConstraint] = myView.topConstraints
myView.cornerRadius = 5.0
myView.borderWidth = 2.0
myView.borderColor = UIColor.blue
mapView.centerMapOnLocation(location, radius:50000)
stackView.add(myView, width:150)