Last active
September 2, 2019 05:00
-
-
Save badrinathvm/76064fadfd17406cee07c2d4d5f9c713 to your computer and use it in GitHub Desktop.
Setting up Container View Controller
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
func setupContainerView() { | |
[containerVC,notchVC].forEach { (viewController) in | |
self.view.addSubview(viewController.view) | |
} | |
heightConstraint = containerVC.view.heightAnchor.constraint(equalToConstant: 0) | |
notchBottomConstraint = notchVC.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor) | |
NSLayoutConstraint.activate([ | |
containerVC.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), | |
containerVC.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), | |
containerVC.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), | |
heightConstraint, | |
notchVC.view.heightAnchor.constraint(equalToConstant: 20), | |
notchVC.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), | |
notchVC.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), | |
notchBottomConstraint | |
]) | |
//setup childViewController ( this view is the bottom sheet ) | |
[containerVC, notchVC].forEach { (viewController) in | |
self.add(viewController) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment