How to best "jump" to a certain view in storyboard?

Ok, I have been trying to search this a lot but can't find something that gives a full reasonable solution, but I am sure several others here have solved this so asking for best advice :-)


Lets say I have a messaging/chat app with several levels, navigation controllers etc


Now lets say there is an event that requires me to "jump" to a certain view regardless (more or less) where in the UI the user is?


eg lets say the user looses the login and should be thrown out to the login screen?

or lets say there is a push notification eg for a chat message and the user has pushed on it and the UI should jump to the relevant view for that message?


How to best accomplish this?


I read up on unwind but it becomes very messy to put unwind links everywhere ... also, this might be triggered from the AppDelegate as a result of a push notification etc so then its even messier...

Replies

If I understand well your need, you could do something like this to switch views:


    destViewController =
         storyboard?.instantiateViewControllerWithIdentifier("Destination")
               as DestViewController
    destViewController.view.frame = view.frame
    switchViewController(from: nil, to: destViewController)