Chapters

Hide chapters

Catalyst by Tutorials

Third Edition · iOS 15 · Swift 5.6 · Xcode 13.3

Section I: Making a Great iPad App

Section 1: 7 chapters
Show chapters Hide chapters

4. Setting the Scene(s)
Written by Marin Bencevic

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In the previous chapter, you learned how to add drag and drop capabilities to your app, making it feel much more natural for both iPad and Mac.

In this chapter, you’ll learn how to enable a feature that’s been available since the beginning on the Mac, and arrived with iOS 13 on the iPad: Multi-window support.

By the end of this chapter, you’ll learn:

  • What multi-window support is and why you’d want to enable it for your app.
  • How to enable basic multi-window support in Xcode and in your app.
  • How your app lifecycle changes under multi-window, and how your architecture might adapt.
  • How to add custom support for drag and drop window creation.

Ready to dive into the exciting world of multiple windows? Awesome! You’re going to start by learning just what multi-window support enables and how it can be useful in iPad and Mac apps.

Introducing Multiple Windows for iPad

In 2007, Apple unveiled the next generation of computing with the introduction of the iPhone. Along with it came an entirely new operating system, designed for touch input and much smaller displays. UIKit was essentially a port of the Mac’s UI system, AppKit, but with some key differences that made it more suitable for powering mobile UI.

One notable difference was that an iPhone app, with its much smaller screen area, could only operate within a single window that occupied the entire screen.

Of course, this was in stark contrast to what users experienced on the Mac, where large desktop displays allowed many windows to run side-by-side across one or many apps.

This contrast remained for several years, until the iPad arrived on the scene, bridging the gap between small 3- to 4-inch mobile screens and massive 32-inch desktop displays. Initially, iOS on iPad looked and felt quite similar to iOS on iPhone, with the same single-window restrictions and every app occupying the entire screen.

But over time, Apple has slowly progressed towards something more akin to what you’d see on the Mac. First, it added the ability to run apps side-by-side. Then it introduced tabs in apps like Safari. With iOS 13, it’s possible for apps to spawn multiple fully-native windows that can run alongside each other or any other app windows.

An app that supports multi-window allows you to create many instances, or windows, containing the entire app UI or a subset of the UI. Each of these windows looks and behaves like a separate instance of the app. However, unlike separate apps, all windows for a given app run as the same process. You’ll learn more about this later.

Why Multi-Window?

In many situations, being able to spawn multiple instances of the same app is extremely handy. Consider the following use-cases that are only possible with multi-window support:

Multi-Window in Action

There are many ways to spawn and interact with multiple app windows on iPad. Some come with the system. Others are specific to individual apps. To get a feel for what’s possible and how multi-window support will work once you add it to the Journalyst app, look at Messages.

Daqfevwa Pulhiked egr ax rne eMij.
Lelkogzi Dijbihaw aff ag zbu aQef.

Wirsufif maljotj mewi-hc-guqi.
Sulfacan gotzobv koce-th-zogu.

Gqel Ojx Qehhuxg.
Fpes Uct Zashobt.

Vulvefeg cepz yurjoflt ur ula gupo uvk dibruyriqiet az ylo agjez tohe.
Luwyaqed lamm lukmivft ax ela rice ull sagpobxajauk un wbi imtuw bemu.

Enabling Multi-Window in Xcode

Open the starter project for this chapter in Xcode and head over to the project settings. Click the Journalyst target and make sure you’re on the General tab. At the very end of the Deployment Info section, you’ll see a checkbox labeled Supports Multiple Windows. Go ahead and check it to, you guessed it, enable multi-window support.

Etorha lepbixla mismorw ax Pwafa.
Esecgi vijnagmo sosriwq ot Cpode.

Introducing Scenes

In the pre-multi-window world, the entry point to every app was the app delegate. Among other things, it would be invoked with all the lifecycle events of the app (launch, active, foreground, background, terminate, etc.). It typically would contain a reference to the single UIWindow instance that housed the app UI.

Adding a Scene Delegate

Now that you’ve learned how scenes allow you to effectively manage multiple instances of your app’s UI, it’s time to finish enabling multi-window support for your project.

Gecjohsu Toannevchq coznitg.
Ralbupxu Woehvujdny lojgovv.

Improving the Standard Multi-Window Experience

Remember that when iOS creates a new scene for your app, it’s instantiating an entirely new and parallel instance of everything required to build your UI. While all scenes operate within the same process and share memory, there’s nothing that inherently connects one scene to another.

Quvu Sofmifu Ceal Reec Zoop Hevpbeqtes Lout Tufmsopnuh Dsohu 6 Fviga 6
Neyhotpo fivmody sialyij.

Oqp Iklhc peqbacqev ar kekhobhi wagtaxq.
Ehy Oypzw yomzulwig or foqwuczi quwtemk.

Orjrf xeyoepx intehar is Ysude 6 zawvobtq ag Yfiha 9.
Oglyx quviusm ekmawec of Zmihi 7 vizcomkp of Rdumi 4.

Adding Custom Drag Behavior to Create a New Window

Recall that when you explored multi-window support in the Messages app at the beginning of this chapter, you tried out a custom mechanism for spawning new scenes. In that app, if you hold and drag a conversation from the sidebar and drop it into the right edge of the screen, the system will create a new window with that conversation.

Mxic uyy snuc uj etxky.
Xsih inj ynec im ifcrj.

Trying it on the Mac

The hard work you put in to make your app support multi-window for iPad has an added bonus: It’ll work seamlessly when you run the app on Mac. Open Xcode, select the My Mac destination and set your team. Then build and run.

Yiwtuphu gajlokw doqyisw ew fxo Vuf.
Luxcirhi rebtetr zotlaly ij zre Can.

Key Points

  • Multi-window is a powerful way to be more productive on iPad and users expect to see it on Mac.
  • You can enable basic multi-window support in an app with a minimal amount of effort.
  • Scenes are a powerful new abstraction that power multi-window on iPad and Mac Catalyst apps.
  • When moving to support multi-window, you need to revisit how your app manages states and relays changes.
  • You can use drag and drop to enable app-specific custom window interactions.

Where to Go From Here?

In this chapter, you learned what multi-window support is, why you might want to incorporate it into your app, and how to do just that. You also learned about some of the issues that you might introduce when adopting scenes and how to resolve them. Finally, you learned how to go beyond the OS-provided multi-window support by adding a custom window interaction using drag and NSUserActivity.

Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum here.
© 2026 Kodeco Inc.

You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now