How to create Segue which make view controller fullscreen in Xcode 11.1

You need to select present modally for the segue type and then right below select the presentation style full screen:

Xcode shot


What you need to do is set the destination view controller's modalPresentationStyle to fullscreen by way of prepareForSegue:sender::

class FirstViewController: UIViewController {

    ...

    @IBAction func segueButtonPressed(_ sender: Any) {
    }

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {

        super.prepare(for: segue, sender: sender)

        if let secondViewController = segue.destination as? SecondViewController {
            secondViewController.modalPresentationStyle = .fullScreen
        }
    }
}

prepareForSegue:sender: is called before a segue is performed from a UIViewController. The default modalPresentationStyle in iOS 13+ is .pageSheet, which is the presentation that doesn't cover the whole screen (though it allows for more natural navigation/dismissal via swiping the view controller down and off the screen). We need to change this modalPresentationStyle to .fullScreen before performing the segue.

Tags:

Xcode

Swift

Segue