<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macOS: 12.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FileProvider",
  "identifier" : "/documentation/FileProvider/NSFileProviderManager/remove(_:mode:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "File Provider"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileProviderManager(cm)removeDomain:mode:completionHandler:"
  },
  "title" : "remove(_:mode:completionHandler:)"
}
-->

# remove(_:mode:completionHandler:)

Removes a domain from the File Provider extension using the specified options.

```
class func remove(_ domain: NSFileProviderDomain, mode: NSFileProviderManager.DomainRemovalMode, completionHandler: @escaping @Sendable (URL?, (any Error)?) -> Void)
```

## Parameters

`domain`

The domain to remove.

`mode`

An option that determines how the system handles user data. For a complete list of options, see [`NSFileProviderManager.DomainRemovalMode`](/documentation/FileProvider/NSFileProviderManager/DomainRemovalMode).

`completionHandler`

A block that the system calls after removing the domain. It takes the following parameter:

- `error`: If an error occurs, this object contains information about the error; otherwise, it’s `nil`.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> class func remove(_ domain: NSFileProviderDomain, mode: NSFileProviderManager.DomainRemovalMode) async throws -> URL?
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

---

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)