Site is currently on development mode

View Controller Presentation Changes in iOS 13

Last updated 1 year ago by Geoff Hackworth



At the time of writing, WWDC 2019 is drawing to a close. Like many iOS developers I’m slowly processing all the new information that Apple threw at us and will be trying to watch as many videos as I can in the coming weeks (and months!)

I have three immediate goals for my own apps:

  1. Do my current apps run without issues on iOS 13? Apple have a long history of backward compatibility based upon the version of Xcode the app was built with. History suggests that Xcode 10-built apps run on iOS 13 will behave as if they were run on iOS 12. But that’s not always the case.
  2. Do my apps work when built with Xcode 11 / iOS 13? Building with the latest tools opts app into new behaviour, bypassing backward-compatibility with previous iOS versions. Did anything break?
  3. What changes could/should I make to my apps to work better or take advantages of new iOS 13 features? This is the biggest task and will take the most time to investigate and implement. That’s a story for another day.

I’ve not yet installed iOS 13 on a real device but I can do some testing for #1 by installing Xcode-10-built apps into the iOS 13 simulator. My post iPad Navigation Bar and Toolbar Height Changes in iOS 12 explains the process in the Wait, What Did You Say? section. (That post was written a year ago so talks about Xcode 9 builds on iOS 12, but the process is the same.)

I’m still working on #2 but based on my initial testing and reading tweets from other developers making similar discoveries, I’ve found a number of behavioural changes to my apps when building with Xcode 11. I have a lot of videos to watch and information to assimilate, but in this post I want to focus on immediately noticeable, and potentially breaking, changes to view controller presentations in iOS 13.

Default Modal Presentation Style Change

The default presentation is now page sheet, not full screen. The header documentation for modalPresentationStyle says:

Defaults to UIModalPresentationAutomatic on iOS starting in iOS 13.0, and UIModalPresentationFullScreen on previous versions.

By default UIViewController resolves UIModalPresentationAutomatic to UIModalPresentationPageSheet, but other system-provided view controllers may resolve UIModalPresentationAutomatic to other concrete presentation styles.

The consequences of this change differ on iPhone and iPad.

Modal Presentations on iPhone

A form sheet, page sheet or popover presentation on iPhone is adapted to full screen unless a UIAdaptivePresentationControllerDelegatemethod is used to prevent the adaption. As an example, a Settings screen might be presented as a form sheet so that it appears full screen on iPhone and in the smaller form sheet size on iPad. Technically, the appearance/adaption depends on the horizontal size class. Form/page/popover presentations on Landscape iPhone Plus and XS Max devices don’t fill the screen because they are regular width. iPad appearance depends on slide over and split-screen multitasking size. It can change whilst a view controller is presented if the horizontal size class changes because the user adjusts or removes the split.

The following screenshots show a form sheet presentation on iPhone XS for three cases: Xcode 10 build run on iOS 12, Xcode 10 build run on iOS 13, and Xcode 11 build run on iOS 13.

Read full Article