Multi-Window support in your iPad app
Native development for iPadOS
Last month Apple released iPadOS, the first dedicated operating system for iPad. It differs from iOS with its support for the larger iPad screen, including multi / split screen windows. I develop apps and it was time to take advantage of these new possibilities that iPadOS offers.
Ever since 2016 I have been using iPad as my main computer, it's a great mobile computer. The operating system is however, unlike that of most computers. iPadOS is based on iOS that runs on Apple's popular mobile phone, the iPhone. This makes the iPad a little different in daily use because of how it run apps.
Because of the smartphone roots of iPadOS, the operating system handles apps like an iPhone does: apps run full screen focused on a single task. People love iPad for this as it's a great way to keep your mind concentrated on a single thing.
Multiple Windows support for iPad
There are situations where running multiple windows simultaneously can be very useful, and this is where Apple improved iPadOS when it introduced support to run apps side-by-side.
Even if you're working on a single task, having support for multiple windows is very useful as it allows you to run multiple instances of the same app at once. This enables different use-cases where you can look and edit content from different angles. Like comparing two different months in your agenda, editing a long document or looking at the map at different scales simultaneously.
When Apple introduced the support for multiple windows on iPad they designed this with respect to the mobile roots of iPadOS. Unlike traditional PC apps, where complex software can run through multiple different windows (and panels) by default, iPadOS maintains the requirement that an app must be able to do everything from a single window.
It's a design requirement on iPad that all app windows are of the same kind, and each one can do everything in the application. The user could do anything from one window if they want to. They should be able to create multiple windows only if they think it's useful, but the app should never require that. This facilitates the simple way apps run oniPadOS, you can continue to use apps full screen like on a smartphone.
App Lifecycle (and code changes)
From a technical perspective Apple introduced UIWindowScene with a corresponding UISceneSession abstraction in the UI structure. It sits between the UIScreen and UIWindow.
When iPadOS (and iOS) run multiple apps, it is possible that the operating systems closes an app from the background to safe memory and power. This is by design: it keeps the operating system fast and kind to the battery.
From an app lifecycle perspective, this means that you need to check if your app was running before when it is started. When there is an existing UISceneSession the app should reconnect to it, to provide a persistent interface state to the user. When done right, the user will not notice that the app was interrupted while in the background.
If you adopt the new UIWindowScene (and UISceneSession) concepts in your app, you'll be able to take advantage of the new multi-window capabilities of iPad. But there is one more thing: Apple is planning to bring iOS and iPadOS apps to the Mac. With the new UI concepts your app will run great on macOS, too!
As developer I had little trouble implementing the new UI concepts in my apps. With relatively little effort you can enable many different use cases where the same app provides more power to the user.
Apple did not rush the support for multiple windows on iPad, but took its time to design it well. If you adopt the new concepts your app will be more powerful to the users.
It's always a good idea to take your time to understand underlying interface concepts before you start developing. Do it right (and good) instead of fast (and stupid)!