I'm new to presenting UIViewcontrollers programmatically, and I'm having some issues presenting its view. Here is my code:
override func willBecomeActive(with conversation: MSConversation) {
let controller = instantiateUserStickersController()
self.addChildViewController(controller)
self.view.addSubview(controller.view) //This line throws the error
}
private func instantiateUserStickersController() -> UIViewController {
guard let controller = storyboard?.instantiateViewController(withIdentifier: "UserStickersViewController") as? UserStickersViewController else { fatalError("Unable to instantiate a UserStickersViewController from the storyboard") }
return controller
}
Why can't I access the controller's view? I'm sure I set the storyboard ID correctly
Here's my storyboard: