An object containing information about one of your app's scenes.


class UISceneSession : NSObject


A UISceneSession object manages a unique runtime instance of your scene. When the user adds a new scene to your app, or when you request one programmatically, the system creates a session object to track that scene. The session contains a unique identifier and the configuration details of the scene. UIKit maintains the session information for the lifetime of the scene itself, destroying the session in response to the user closing the scene in the app switcher.

You do not create session objects directly. UIKit creates sessions in response to user interactions with your app. You can also ask UIKit to create a new scene and session programmatically by calling the requestSceneSessionActivation(_:userActivity:options:errorHandler:) method of UIApplication. UIKit initializes the session with default configuration data based on the contents of your app's Info.plist file.


Getting the Scene Information

var scene: UIScene?

The scene associated with the current session.

var role: UISceneSession.Role

The role played by the scene's content.

struct UISceneSession.Role

Constants indicating the possible roles for a scene.

Getting the Scene Configuration Details

var configuration: UISceneConfiguration

The configuration data for creating the scene.

Identifying the Scene

var persistentIdentifier: String

A unique identifier that persists for the lifetime of the session.

Getting Additional Session Information

var stateRestorationActivity: NSUserActivity?

An activity object you can use to restore the previous contents of your scene's interface.

var userInfo: [String : Any]?

Custom attributes that you can associate with the scene.


Inherits From

See Also


Specifying the Scenes Your App Supports

Tell the system about your app’s scenes, including the objects you use to manage each scene and its initial user interface.

property list key UIApplicationSceneManifest

The information about the app's scene-based life-cycle support.

Name: Application Scene Manifest
class UISceneConfiguration

Information about the objects and storyboard for UKit to use when creating a particular scene.