Search code examples
swiftuiviewcontrolleruimodalpresentationstyleuiviewcontrollerrepresentableios18

How to make bigger sized presented view same as like earlier version in iOS 18 - Swift


I'm facing an issue in presenting UIViewController in iOS 18. For the earlier version presentation looks good.

I need a same height and width in every version.

Any quick solution is appreciated. Thank you!

SAMPLE CODE OVER GITHUB

@IBAction func didTap(_ sender: UIButton) {
    if let sVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "SecondVC") as? SecondVC {
        self.present(sVC, animated: true)
    }
}

enter image description here


Solution

  • The problem is that you have the Presentation Style set to Automatic in the storyboard. Set it to Page Sheet instead.

    enter image description here