<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FileProvider",
  "identifier" : "/documentation/FileProvider/NSFileProviderManager/waitForStabilization(completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "File Provider",
      "FileProvider"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileProviderManager(im)waitForStabilizationWithCompletionHandler:"
  },
  "title" : "waitForStabilization(completionHandler:)"
}
-->

# waitForStabilization(completionHandler:)

Requests a notification after the domain stabilizes.

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

## 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:

- `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
> func waitForStabilization() async throws
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/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:)`](/documentation/FileProvider/NSFileProviderManager/waitForStabilization(completionHandler:)), but which haven’t completed yet.

> Warning:
> Only use ``doc://com.apple.fileprovider/documentation/FileProvider/NSFileProviderManager/waitForStabilization(completionHandler:)`` for testing and debugging. Don’t call this method in a production app, due to its high performance cost.

---

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)