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

# move(to:completionHandler:)

Moves the document’s file to the given URL.

```
func move(to url: URL, completionHandler: (((any Error)?) -> Void)? = nil)
```

## Parameters

`url`

The location where the file will ultimately end up, if the move is successful.

`completionHandler`

The completion handler block object passed in to be invoked at some point in the future, perhaps after the method invocation has returned. The completion handler must be invoked on the main thread. On output, a `nil` error is passed if the move is successful; otherwise an <doc://com.apple.documentation/documentation/Foundation/NSError> object is passed that encapsulates the reason for failure.

## Discussion

The default implementation of this method replaces any file that may currently exist at the given URL with the one being moved, as necessary.

## See Also

[`moveToUbiquityContainer(_:)`](/documentation/AppKit/NSDocument/moveToUbiquityContainer(_:))

Moves the document to the user’s iCloud storage.



---

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)