requestSceneSessionDestruction(_:options:errorHandler:)
Asks the system to dismiss an existing scene and remove it from the app switcher.
Declaration
func requestSceneSessionDestruction(_ sceneSession: UISceneSession, options: UISceneDestructionRequestOptions?, errorHandler: ((any Error) -> Void)? = nil)Parameters
- sceneSession:
The session whose scene you want to remove from the screen and app switcher.
- options:
Information for the system to use when dismissing the scene. For information about how to create this object, see Uiscenedestructionrequestoptions.
- errorHandler:
An error handler block to execute if a problem occurs. The method does not execute this block when it successfully dismisses the scene. This block has no return value and has the following parameter:
- error
The Nserror object describing the problem that occurred.
Discussion
If the specified scene is onscreen, calling this method dismisses it using the specified options. The method sends a disconnect notification to the scene and then calls your app delegate’s application(_:didDiscardSceneSessions:) method.