---
title: "getDomainsWithCompletionHandler(_:)"
framework: fileprovider
role: symbol
role_heading: Type Method
path: "fileprovider/nsfileprovidermanager/getdomainswithcompletionhandler(_:)"
---

# getDomainsWithCompletionHandler(_:)

Returns all of the File Provider extension’s domains.

## Declaration

```swift
class func getDomainsWithCompletionHandler(_ completionHandler: @escaping @Sendable ([NSFileProviderDomain], (any Error)?) -> Void)
```

```swift
class func domains() async throws -> [NSFileProviderDomain]
```

## Discussion

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: class func domains() async throws -> [NSFileProviderDomain] For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.

## See Also

### Working with domains

- [init(for:)](fileprovider/nsfileprovidermanager/init(for:).md)
- [import(_:fromDirectoryAt:completionHandler:)](fileprovider/nsfileprovidermanager/import(_:fromdirectoryat:completionhandler:).md)
- [add(_:completionHandler:)](fileprovider/nsfileprovidermanager/add(_:completionhandler:).md)
- [remove(_:completionHandler:)](fileprovider/nsfileprovidermanager/remove(_:completionhandler:).md)
- [remove(_:mode:completionHandler:)](fileprovider/nsfileprovidermanager/remove(_:mode:completionhandler:).md)
- [removeAllDomains(completionHandler:)](fileprovider/nsfileprovidermanager/removealldomains(completionhandler:).md)
- [NSFileProviderManager.DomainRemovalMode](fileprovider/nsfileprovidermanager/domainremovalmode.md)
- [disconnect(reason:options:completionHandler:)](fileprovider/nsfileprovidermanager/disconnect(reason:options:completionhandler:).md)
- [NSFileProviderManager.DisconnectionOptions](fileprovider/nsfileprovidermanager/disconnectionoptions.md)
- [reconnect(completionHandler:)](fileprovider/nsfileprovidermanager/reconnect(completionhandler:).md)
- [waitForStabilization(completionHandler:)](fileprovider/nsfileprovidermanager/waitforstabilization(completionhandler:).md)
- [temporaryDirectoryURL()](fileprovider/nsfileprovidermanager/temporarydirectoryurl().md)
