December 2018
Intermediate to advanced
414 pages
10h 19m
English
Adding a child view controller is possible with the func addChild(_ childController: UIViewController) available on UIViewController instances. When using this function, you effectively create a strong relationship between the container view controller and the child view controller.
This relationship is necessary, in order to make sure that all the container view controller lifecycle calls are properly forwarded to the children. Doing so will ensure the child view controllers behave like standalone view controllers.
The following is a snippet that will help you safely add a child view controller with animations:
extension UIViewController { func add(_ childController: UIViewController, with animations: (() -> ...Read now
Unlock full access