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


class UIScene : UIResponder


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 do not 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.


Creating a Scene Object

init(session: UISceneSession, connectionOptions: UIScene.ConnectionOptions)

Creates a scene object using the specified session and connection information.

Managing the Life Cycle of a Scene

var delegate: UISceneDelegate?

The object you use to receive life-cycle events associated with the scene.

protocol UISceneDelegate

The core methods you use to respond to life-cycle events occurring within a scene.

Getting the Scene Attributes

var activationState: UIScene.ActivationState

The current execution state of the scene.

enum UIScene.ActivationState

Constants indicating the foreground or background execution state of your app.

var title: String!

A user-visible string you supply to help users differentiate among your app's scenes.

Specifying the Scene's Activation Conditions

var activationConditions: UISceneActivationConditions

The conditions that define when UIKit activates the scene object.

Responding to Life Cycle Notifications

class let willConnectNotification: NSNotification.Name

A notification indicating that UIKit added a scene to your app.

class let didDisconnectNotification: NSNotification.Name

A notification indicating that UIKit removed a scene from your app.

class let willEnterForegroundNotification: NSNotification.Name

A notification indicating that a scene is about to begin running in the foreground and become visible to the user.

class let didActivateNotification: NSNotification.Name

A notification indicating that the scene is now onscreen and responding to user events.

class let willDeactivateNotification: NSNotification.Name

A notification indicating that the scene is about to resign the active state and stop responding to user events.

class let didEnterBackgroundNotification: NSNotification.Name

A notification indicating that the scene is running in the background and is no longer onscreen.

Getting the Scene's Session

var session: UISceneSession

The session associated with the scene.

Opening URLs

func open(URL, options: UIScene.OpenExternalURLOptions?, completionHandler: ((Bool) -> Void)?)

Attempts to open the resource at the specified URL asynchronously.


class UIScene.ActivationRequestOptions

An object containing information you want the system to use when activating the session associated with a scene.

class UISceneDestructionRequestOptions

An object you pass to UIKit when you want to permanently remove a scene and its associated session from your app.

class UIScene.OpenExternalURLOptions

Options you specify when asking a scene to open a URL.

class UIScene.OpenURLOptions

Options that UIKit provides when asking your app to open a URL.

See Also

Window Scenes

Supporting Multiple Windows on iPad

Use the UIScene lifecycle to support two side-by-side instances of your interface and learn how to create a new window with drag and drop.

protocol UIWindowSceneDelegate

Additional methods that you use to manage app-specific tasks occurring in a scene.

class UIWindowScene

A specific type of scene that manages one or more windows for your app.

protocol UISceneDelegate

The core methods you use to respond to life-cycle events occurring within a scene.


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software