Contents

UIScene

An object that represents one instance of your app’s user interface.

Declaration

@MainActor class UIScene

Overview

UIKit creates a scene object for each instance of your app’s UI that the user or your app requests. Typically, UIKit creates a UIWindowScene object instead of a UIScene object, but you use the methods and properties of this class to access information about a scene.

Every scene object has an associated delegate object, an object that adopts the UISceneDelegate protocol. When the state of the scene changes, the scene object notifies its delegate object and posts appropriate notifications to registered observer objects. Use the delegate object and notifications to respond to changes in the state of the scene. For example, use it to determine when your scene moves to the background.

You don’t create scene objects directly. You can programmatically ask UIKit to create a scene object for your app by calling the requestSceneSessionActivation(_:userActivity:options:errorHandler:) method of UIApplication. UIKit also creates scenes in response to user interactions. When configuring your app’s scene support, specify UIWindowScene objects instead of UIScene objects.

Topics

Creating a scene object

Managing the life cycle of a scene

Getting the scene attributes

Specifying the scene’s activation conditions

Specifying the scene’s destruction conditions

Responding to life cycle notifications

Working with system protection manager

Getting the scene’s session

Opening URLs

Supporting state restoration

Getting the pointer lock state

Constants

Structures

Instance Methods

See Also

Window scenes