<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/unlock(completionHandler:)-8p8zd",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(im)unlockDocumentWithCompletionHandler:"
  },
  "title" : "unlock(completionHandler:)"
}
-->

# unlock(completionHandler:)

Allows the user to make modifications to the document.

```
func unlock(completionHandler: ((Bool) -> Void)? = nil)
```

## Parameters

`completionHandler`

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

## Discussion

By default, this method invokes the [`unlock(completionHandler:)`](/documentation/AppKit/NSDocument/unlock(completionHandler:)-6m7rh) method to unlock the document. This method disables autosaving safety checking, meaning that [`checkAutosavingSafety()`](/documentation/AppKit/NSDocument/checkAutosavingSafety()) will no longer be invoked on this document. When unlocking succeeds, the [`isLocked`](/documentation/AppKit/NSDocument/isLocked) method will begin returning <doc://com.apple.documentation/documentation/Swift/false>.

---

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)