Oneline
如何使用
初始化 UIView,然后连接并设置其属性。
let label = UILabel("Hi, there!").font(.systemFont(ofSize: 12)).color(.blue).lines().bgColor(.green).align(.center)
而不是
let label = UILabel()
label.text = "Hi, there!"
label.font = .systemFont(ofSize: 12)
label.textColor = .blue
label.numberOfLines = 0
label.backgroundColor = .green
label.textAlignment = .center
支持的控制
- UIView
⬜️ - UIControl
🔳 - UIButton
🔵 - UILabel ☗
- UITextField ✒︎
- UIStackView ❏
Cocoapods
在您的 Podfile 中添加以下条目
pod 'Oneline'
然后运行 pod install
。
贡献
请随意分叉,提交您的常用 UIView 子类请求。
许可协议
Oneline遵循MIT许可协议发布。