Skip to content

Instantly share code, notes, and snippets.

@badrinathvm
Last active September 2, 2019 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save badrinathvm/76064fadfd17406cee07c2d4d5f9c713 to your computer and use it in GitHub Desktop.
Save badrinathvm/76064fadfd17406cee07c2d4d5f9c713 to your computer and use it in GitHub Desktop.
Setting up Container View Controller
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