<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLFileProtection",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSURLFileProtectionType"
  },
  "title" : "URLFileProtection"
}
-->

# URLFileProtection

Protection-level values for a URL resource key.

```
struct URLFileProtection
```

## Overview

These are values for the [`URLResourceKey`](/documentation/Foundation/URLResourceKey) key [`fileProtectionKey`](/documentation/Foundation/URLResourceKey/fileProtectionKey).

## Topics

### Creating a URL File Protection Type

[`init(rawValue:)`](/documentation/Foundation/URLFileProtection/init(rawValue:))

Creates a URL file protection type value.

### Protection levels

[`complete`](/documentation/Foundation/URLFileProtection/complete)

An option that instructs the system to store the file in an encrypted format on-disk that your app can’t access for reading or writing to while the device is locked or booting.

[`completeUnlessOpen`](/documentation/Foundation/URLFileProtection/completeUnlessOpen)

An option that instructs the system to store the file in an encrypted format on-disk after it closes.

[`completeUntilFirstUserAuthentication`](/documentation/Foundation/URLFileProtection/completeUntilFirstUserAuthentication)

An option that instructs the system to store the file in an encrypted format on-disk that your app can’t access until after the device boots.

[`completeWhenUserInactive`](/documentation/Foundation/URLFileProtection/completeWhenUserInactive)

An option that instructs the system to store the file in an encrypted format on-disk that your app can access only after device unlock and before expiration.

[`none`](/documentation/Foundation/URLFileProtection/none)

An option that indicates the file has no special protections associated with it.



---

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)