Instance Method

scene(_:willConnectTo:options:)

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

Declaration

optional func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)

Parameters

scene

The scene object being connected to your app.

session

The session object containing details about the scene's configuration.

options

Additional options to use when configuring the scene. Use the information in this object to handle actions that caused the creation of the scene. For example, use it to respond to a quick action selected by the user.

Discussion

When the user or your app requests a new instance of your user interface, UIKit creates an appropriate scene object and connects it to your app. Use this method to respond to the addition of the new scene and to begin loading any data that the scene needs to display. Use the information in the options parameter to perform any additional setup or actions requested by the system or user.

In addition to calling this method, UIKit also posts a willConnectNotification notification.

See Also

Connecting and Disconnecting the Scene

func sceneDidDisconnect(UIScene)

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

class UIScene.ConnectionOptions

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