<!--
{
  "availability" : [
    "iOS: 6.0.0 - 13.2.0",
    "iPadOS: 6.0.0 - 13.2.0",
    "macCatalyst: 13.1.0 - 13.2.0",
    "tvOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIApplicationDelegate/application(_:shouldSaveApplicationState:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UIApplicationDelegate(im)application:shouldSaveApplicationState:"
  },
  "title" : "application(_:shouldSaveApplicationState:)"
}
-->

# application(_:shouldSaveApplicationState:)

Asks the delegate whether to preserve the app’s state.

```
optional func application(_ application: UIApplication, shouldSaveApplicationState coder: NSCoder) -> Bool
```

## Parameters

`application`

Your singleton app object.

`coder`

The keyed archiver into which you can put high-level state information.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the app’s state should be preserved; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Apps must implement this method and the [`application(_:shouldRestoreApplicationState:)`](/documentation/UIKit/UIApplicationDelegate/application(_:shouldRestoreApplicationState:)) method for state preservation to occur. In addition, your implementation of this method must return <doc://com.apple.documentation/documentation/Swift/true> each time UIKit tries to preserve the state of your app. You can return <doc://com.apple.documentation/documentation/Swift/false> to disable state preservation temporarily. For example, during testing, you could disable state preservation to test specific code paths.

You can add version information or any other contextual data to the provided coder object as needed. During restoration, you can use that information to help decide whether or not to proceed with restoring your app to its previous state.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)