Skip to content

0.6.0

Choose a tag to compare

@insub4067 insub4067 released this 07 Nov 16:12
· 32 commits to main since this release

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)
}