Protocol

UISceneDelegate

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

Declaration

@protocol UISceneDelegate

Overview

Use your UISceneDelegate object to manage life-cycle events in one instance of your app's user interface. This interface defines methods for responding to state transitions that affect the scene, including when the scene enters the foreground and becomes active, and when it enters the background. Use your delegate to provide appropriate behavior when these transitions occur. For example, finish critical tasks and quiet your app when it enters the background.

Do not create UISceneDelegate objects directly. Instead, specify the name of your custom delegate class as part of the configuration data for your scenes. You can specify this information in your app's Info.plist file, or in the UISceneConfiguration object you return from your app delegate's application:configurationForConnectingSceneSession:options: method. For more information about how to configure scenes, see XREF.

Topics

Connecting and Disconnecting the Scene

- scene:willConnectToSession:options:

Tells the delegate about the addition of a scene to the app.

- sceneDidDisconnect:

Tells the delegate that UIKit removed a scene from your app.

UISceneConnectionOptions

A data object containing information about the reasons why UIKit created the scene.

Transitioning to the Foreground

- sceneWillEnterForeground:

Tells the delegate that the scene is about to begin running in the foreground and become visible to the user.

- sceneDidBecomeActive:

Tells the delegate that the scene became active and is now responding to user events.

Transitioning to the Background

- sceneWillResignActive:

Tells the delegate that the scene is about to resign the active state and stop responding to user events.

- sceneDidEnterBackground:

Tells the delegate that the scene is running in the background and is no longer onscreen.

Opening URLs

- scene:openURLContexts:

Asks the delegate to open one or more URLs.

Continuing User Activities

- scene:willContinueUserActivityWithType:

Tells the delegate that it is about to receive Handoff-related data.

- scene:continueUserActivity:

Tells the delegate to handle the specified Handoff-related activity.

- scene:didFailToContinueUserActivityWithType:error:

Tells the delegate that the activity could not be continued.

Saving the State of the Scene

- stateRestorationActivityForScene:

Returns a user activity object encapsulating the current state of the specified scene.

- scene:didUpdateUserActivity:

Tells the delegate that the specified activity object was updated.

See Also

Window Scenes

UIWindowSceneDelegate

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

UIWindowScene

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

UIScene

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