#Introduction
Then Library is a Super sweet syntactic sugar for Swift initializers. It makes easier to code and clean.
Installation
First pod init to the project and add this lines of code to podfile
pod 'Then'
Next just run pod install in terminal. Congratulation!!! you have installed it.
Example:
let btn = UIButton().then {
$0.setTitle("Add New", for: .normal)
$0.backgroundColor = UIColor.blue
}
This equivalence to:
lazy var btn: UIButton = {
let btn: UIButton = UIButton()
btn.setTitle("Add New", for: .normal)
btn.backgroundColor = UIColor.blue
return btn
}()
#Sample Code with 'Then'
Here is the sample code which is about Then in GitHub