Created
March 11, 2021 17:45
-
-
Save iamidzic/9874a63a7d15ddbc18b8795f48a886f7 to your computer and use it in GitHub Desktop.
SettingsChildView
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
private func addSettingsView() { | |
let settingsView = SettingsView() | |
let hostingController = UIHostingController(rootView: settingsView) | |
addChild(hostingController) | |
view.addSubview(hostingController.view) | |
hostingController.view.translatesAutoresizingMaskIntoConstraints = false | |
hostingController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true | |
hostingController.view.topAnchor.constraint(equalTo: view.topAnchor).isActive = true | |
hostingController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true | |
hostingController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true | |
hostingController.didMove(toParent: self) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment