Created
October 8, 2017 10:53
-
-
Save dmytro-anokhin/d4d18b49708cac121361116000db2317 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var leftViewController: UIViewController? { | |
willSet { | |
guard let child = leftViewController else { return } | |
child.willMove(toParentViewController: nil) | |
child.view.removeFromSuperview() | |
child.removeFromParentViewController() | |
} | |
didSet { | |
guard let child = leftViewController else { return } | |
loadViewIfNeeded() // Make sure the view is loaded | |
addChildViewController(child) | |
child.view.frame = leftContainerView.bounds | |
leftContainerView.contentView = child.view // Layout managed by container view | |
child.didMove(toParentViewController: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment