CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✓ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Oct 2015 |
Maintained by ukitaka.
| Depends on: | |
| ISMethodSwizzling | >= 0 |
| Aspects | >= 0 |
IBOutlets are initialized during view loading process and they are not accessible at the point you are trying to reach them.
In UIViewController, afterViewDidLoad guarantees that block will invoke after view is loaded.
If isViewLoaded is true, invoke a block immediately.
@IBOutlet weak var label: UILabel!
func configLabel(text: String) {
afterViewDidLoad {
self.label.text = text
}
}
afterViewDidLoadSafety is available to perform more safely.
guard let _ = try? afterViewDidLoadSafety({ self.label.text = text }) else {
preconditionFailure()
}
Similarly, afterAwakeFromNib is available in a UIView.
func configLabel(text: String) {
afterAwakeFromNib {
self.label.text = text
}
}
afterViewDidLoad guarantees that block will invoke after viewDidAppear:.
For example, if you call presentViewController before viewDidAppear:, then the warning "Presenting view controllers on detached view controllers is discouraged…" will be displayed in Xcode.
afterViewDidAppear can be used as follows
afterViewDidAppear {
self.presentViewController(vc, animated: true, completion: nil)
}
UILifeCycleClosure is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "UILifeCycleClosure"ukitaka, [email protected]
UILifeCycleClosure is available under the MIT license. See the LICENSE file for more info.