Chained initializers in Swift.
let label = UILabel()
.backgroundColor(.black)
.textColor(.white)
.textAlignment(.center)
.font(.systemFont(ofSize: 16))
.text("Hello World")
ChainKit allows you to set properties of many UIKit
and Foundation
objects during initialization. This can result in clearer syntax and allow the setup of objects without having to rely on verbose closures.
pod 'ChainKit', :git => 'https://github.com/justinroam/ChainKit.git'
To integrate ChainKit into your Xcode project using Carthage, specify it in your Cartfile
:
github "avario/ChainKit" ~> 0.4
Run carthage update
to build the framework and drag the built ChainKit.framework
into your Xcode project.
- UIView
- UILabel
- UITextField
- UIImageView
- UIScrollView
- UITableView
- UICollectionView
- UICollectionViewFlowLayout
- UITextView
- UIButton
- UIStackView
- UIToolbar
- NumberFormatter
- DateFormatter