-
-
Save candostdagdeviren/9d5eb96712d4ab99fa6286c797aead84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adding a view controller to another | |
let childViewController = UIViewController() | |
let parentViewController = UIViewController() | |
parentViewController.addChild(childViewController) | |
parentViewController.view.addSubview(childViewController.view) | |
// setup auto-layout constraints for childViewController.view | |
childViewController.didMove(toParent: parentViewController) | |
// Removing the child view controller from parent | |
childViewController.willMove(toParent: nil) | |
childViewController.view.removeFromSuperview() | |
childViewController.removeFromParent() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment