---
title: "waitForStabilization(completionHandler:)"
framework: fileprovider
role: symbol
role_heading: Instance Method
path: "fileprovider/nsfileprovidermanager/waitforstabilization(completionhandler:)"
---

# waitForStabilization(completionHandler:)

Requests a notification after the domain stabilizes.

## Declaration

```swift
func waitForStabilization(completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func waitForStabilization() async throws
```

## Parameters

- `completionHandler`: A block that the system calls after pending changes to both the file system and the provider have completed. The system passes the following parameters:

## 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: func waitForStabilization() async throws For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. Use this method to enforce a consistent state for testing. The system calls the completion handler after all the pending changes to the local cache and the remote storage have completed. The system waits on any changes that requested before the call to waitForStabilization(completionHandler:), but which haven’t completed yet. warning: Only use waitForStabilization(completionHandler:) for testing and debugging. Don’t call this method in a production app, due to its high performance cost.

## 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)
- [getDomainsWithCompletionHandler(_:)](fileprovider/nsfileprovidermanager/getdomainswithcompletionhandler(_:).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)
- [temporaryDirectoryURL()](fileprovider/nsfileprovidermanager/temporarydirectoryurl().md)
