---
title: "unlock(completionHandler:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocument/unlock(completionhandler:)-6m7rh"
---

# unlock(completionHandler:)

Allows the user to make modifications to the document’s file.

## Declaration

```swift
func unlock(completionHandler: (((any Error)?) -> Void)? = nil)
```

```swift
func unlock() async throws
```

## Parameters

- `completionHandler`: The completion handler block object passed in to be invoked after unlocking is completed, regardless of success or failure.

## Discussion

Discussion By default, this method tries to clear the “user immutable” flag and, if necessary, add write permissions to the file itself.

## See Also

### Locking the Document

- [lock(_:)](appkit/nsdocument/lock(_:).md)
- [unlock(_:)](appkit/nsdocument/unlock(_:).md)
- [lock(completionHandler:)](appkit/nsdocument/lock(completionhandler:)-6zuhh.md)
- [lock(completionHandler:)](appkit/nsdocument/lock(completionhandler:)-161qv.md)
- [unlock(completionHandler:)](appkit/nsdocument/unlock(completionhandler:)-8p8zd.md)
- [isLocked](appkit/nsdocument/islocked.md)
