Skip to main content

UIScene

Supporting Multiple Windows on iPad

WWDC 2019 - Introducing Multiple Windows on iPad

WWDC 2019 - Window Management in Your Multitasking App

WWDC 2019 - Architecting Your App for Multiple Windows

WWDC 2019 - Targeting Content with Multiple Windows

iOS 13.0+ required.

Xcode - Gallery.xcodeproj - General - Deployment Info - Support multiple windows

Every device has at least one UIScreen object representing the device’s main screen, and additional screen objects represent connected displays. UIScreen 代表和它关联的设备!

A UIWindow object provides no visible content of its own. All of the window's visible content is provided by its root view controller. The window's role is to receive events from UIKit and to forward any relevant events to the root view controller and associated views.

img

A UISceneSession object manages a unique runtime instance of your scene. You do not create session objects directly.

UIWindowScene is a UIScene. Typically, UIKit creates a UIWindowScene object instead of a UIScene object. You do not create scene objects directly.

Every time a new window gets created on the system, you get informed through the application delegate that a new session has been made. And every time one has been destroyed by the user, either through interactions with our APIs, or because they swiped up in the switcher, you get informed that that session has been destroyed. And UIScenes connect to and disconnect from these sessions over the lifetime of your application.