So I am using some Storyboard References to bring in some structure. Now I am trying to change the ViewController from code, but I am not able to use a ViewController from a different Storyboard. My Code is currently looking like that:
func showCommunityDetail(){
let storyBoard : UIStoryboard = UIStoryboard(name: "community", bundle:nil)
let nextViewController = storyBoard.instantiateViewController(withIdentifier: "communityDetail") as! CommunityViewController
self.present(nextViewController, animated:true, completion:nil)
}
The community Storyboard contains the communityDetail controller, but the view which is shown at the moment this code is executed, is in a different storyboard.
How can I present between different Storyboards?
Update
I updated my code to the following line:
let detailViewController = UIStoryboard(name: "community", bundle: nil).instantiateViewController(withIdentifier: "communityDetail");
However, now i get a new error: whose view is not in the window hierarchy!