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

# application(_:shouldSaveSecureApplicationState:)

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

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

## Parameters

`application`

The singleton app object.

`coder`

A keyed archiver where you can store high-level state information. The coder’s <doc://com.apple.documentation/documentation/Foundation/NSCoder/requiresSecureCoding> property is set to <doc://com.apple.documentation/documentation/Swift/true>, and any objects you encode must adopt <doc://com.apple.documentation/documentation/Foundation/NSSecureCoding>.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> to securely preserve the app’s state; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

Apps must implement both this method and [`application(_:shouldRestoreSecureApplicationState:)`](/documentation/UIKit/UIApplicationDelegate/application(_:shouldRestoreSecureApplicationState:)) for state preservation to occur.

Your implementation of this method should return <doc://com.apple.documentation/documentation/Swift/true> each time UIKit attempts to preserve the state of your app. You can temporarily disable state preservation by returning <doc://com.apple.documentation/documentation/Swift/false>, which you may want to do during testing, for example.

You can add version information or any other contextual data to the provided coder as necessary. During restoration, you can use that information to determine whether to proceed with restoring your app to its previous state. Any objects you add to the coder must adopt the <doc://com.apple.documentation/documentation/Foundation/NSSecureCoding> protocol.

This method supersedes [`application(_:shouldSaveApplicationState:)`](/documentation/UIKit/UIApplicationDelegate/application(_:shouldSaveApplicationState:)). If your delegate implements both methods, the system only calls this one.

---

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)