Search code examples
iosswiftstoryboardsegue

iOS segue from modal to non-modal


I have a log in with email modal and from there I want to segue to the home screen non-modally.

Currently the flow works but is presenting the home screen modally. How would I present it normally?

from modal screen upon successful log in:

                let storyboard = UIStoryboard(name: "Main", bundle: nil)
                let vc = storyboard.instantiateViewController(identifier: "tabBarController")

//                self.present(vc, animated: true) //works but modally
                  self.show(vc, sender: self)  //works but modally

Solution

  • You could do something like this:

    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewController(identifier: "tabBarController")
    vc.modalPresentationStyle = .overFullScreen
    vc.modalTransitionStyle = .crossDissolve
    self.show(vc, sender: self)