0.6.0
Full Changelog: 0.5.0...0.6.0
New Feat
public extension UIView {
convenience init(builder: (Self) -> Void) {
self.init()
translatesAutoresizingMaskIntoConstraints = false
builder(self)
}
func addToSuperView(_ view: UIView) {
view.addSubview(self)
}
}Example
lazy var count = UILabel {
$0.text = String(store.count)
$0.textColor = .black
$0.addToSuperView(self.view)
}
lazy var button = UIButton {
$0.setTitle("Button", for: .normal)
$0.setTitleColor(.black, for: .normal)
$0.eventPublisher(for: .touchUpInside).sink {
print("tap")
}.store(in: &cancellable)
$0.addToSuperView(self.view)
}