Search code examples
iosswiftuiviewcontrolleruimodalpresentationstyle

modalPresentationStyle default value in iOS 13


As per apple documentation,

The default value for this property is UIModalPresentationStyle.automatic

In iOS 12, the default value was UIModalPresentationStyle.fullScreen, and that what I get.

But when I am running my app on iOS 13 I am getting .pageSheet as navigationController.modalPresentationStyle

Is there anything I am doing wrong or the default value is .pageSheet?


Solution

    1. UIModalPresentationStyle.automatic switches between .pageSheet and .fullScreen depending on the context in which UIViewController is presented.
    2. If you are using normal UIViewController it will default to .pageSheet.
    3. But if you are using some subclass of UIViewController like UIImagePickerController iOS expects content should in full screen mode so it will default to .fullscreen.
    4. If you are using iOS version less than 13 it will always default to .fullscreen.