LoginSignup
2
0

More than 5 years have passed since last update.

'Then' Library for Swift Initializers with ReactorKit

Last updated at Posted at 2018-09-12

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

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0