---
title: "sceneDidDisconnect(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiscenedelegate/scenediddisconnect(_:)"
---

# sceneDidDisconnect(_:)

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

## Declaration

```swift
optional func sceneDidDisconnect(_ scene: UIScene)
```

## Parameters

- `scene`: The scene that UIKit disconnected from your app.

## Mentioned in

Presenting content on a connected display

## Discussion

Discussion Use this method to perform any final cleanup before your scene is purged from memory. For example, use it to release references to files or shared resources and to save user data. The removal of a scene is a precursor to the destruction of that scene. UIKit disconnects a scene when the user explicitly closes it in the app switcher. UIKit may also disconnect a scene in order to reclaim memory for other processes. UIKit does not automatically disconnect a scene when the user switches to another app. UIKit also posts a didDisconnectNotification notification in addition to calling this method.

## See Also

### Connecting and disconnecting the scene

- [scene(_:willConnectTo:options:)](uikit/uiscenedelegate/scene(_:willconnectto:options:).md)
- [UIScene.ConnectionOptions](uikit/uiscene/connectionoptions.md)
