---
title: completeUnlessOpen
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/urlfileprotection/completeunlessopen
---

# completeUnlessOpen

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

## Declaration

```swift
static let completeUnlessOpen: URLFileProtection
```

## Discussion

Discussion Files with this type of protection can be created while the device is locked, but once closed, cannot be opened again until the device is unlocked. If the file is opened when unlocked, you may continue to access the file normally, even if the user locks the device. There is a small performance penalty when the file is created and opened, though not when being written to or read from. This can be mitigated by changing the file protection to complete when the device is unlocked.

## See Also

### Protection levels

- [complete](foundation/urlfileprotection/complete.md)
- [completeUntilFirstUserAuthentication](foundation/urlfileprotection/completeuntilfirstuserauthentication.md)
- [completeWhenUserInactive](foundation/urlfileprotection/completewhenuserinactive.md)
- [none](foundation/urlfileprotection/none.md)
