Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xmhafiz/90fc7c80c6005e9ea1dc159ed7409731 to your computer and use it in GitHub Desktop.
Save xmhafiz/90fc7c80c6005e9ea1dc159ed7409731 to your computer and use it in GitHub Desktop.
class BottomSheetViewController: UIViewController {
// ...
// sub-class of this view controller will call this function to set a content
func setContent(content: UIView) {
contentView.addSubview(content)
NSLayoutConstraint.activate([
content.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
content.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
content.topAnchor.constraint(equalTo: contentView.topAnchor),
content.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
])
view.layoutIfNeeded()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment