<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ManagedApp",
  "identifier" : "/documentation/ManagedApp/ManagedAppConfigurationProvider/configurations(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "ManagedApp"
    ],
    "preciseIdentifier" : "s:10ManagedApp0aB21ConfigurationProviderC14configurationsyQrxmYaSeRzlF"
  },
  "title" : "configurations(_:)"
}
-->

# configurations(_:)

Provides an asynchronous sequence of configurations that the MDM admin specifies.

```
func configurations<Configuration>(_ t: Configuration.Type) async -> some AsyncSequence<Optional<Configuration>, Never> where Configuration : Decodable
```

## Parameters

`t`

A type you provide that decodes and validates the configuration.

## Return Value

An <doc://com.apple.documentation/documentation/Swift/AsyncSequence> of optionals of the specified type. When the framework instantiates the result, the sequence yields the current configuration immediately. The sequence yields `nil` if a decoding error occurs or if the MDM admin currently provides no configuration for the app.

## Discussion

The MDM server provides an encoded configuration to the framework using <doc://com.apple.documentation/documentation/DeviceManagement>. The argument you pass in to this method is a type you implement that decodes the configuration definition. Your custom type also becomes the element of the returned sequence. Your decoder processes the configuration according to your specification, which the MDM admin uses to define the configuration on the server.

When you begin iterating the returned sequence using `for await`, the sequence yields the current configuration immediately, or `nil` if the MDM admin hasn’t provided a configuration. If the MDM admin provides or changes the configuration at runtime, the sequence yields a new configuration object if decoding succeeds. If decoding fails, the framework discards the updated configuration and the sequence yields `nil`.

In addition, the type you pass in can:

- Use default values for optional portions of the configuration not provided by the MDM server.
- Validate expected ranges for values.
- Perform other custom validation.

The device reports the result of decoding to the MDM server. On success, the device reports a valid state to the server. However, if the decoder throws an error conforming to [`ManagedAppConfigurationDecodingError`](/documentation/ManagedApp/ManagedAppConfigurationDecodingError), the device reports an invalid state to the server and logs an error that contains the [`code`](/documentation/ManagedApp/ManagedAppConfigurationDecodingError/code) and [`message`](/documentation/ManagedApp/ManagedAppConfigurationDecodingError/message) properties. The MDM admin can use the device’s event log to understand the cause when the server receives an invalid state.

If the decoder throws an error that doesn’t conform to [`ManagedAppConfigurationDecodingError`](/documentation/ManagedApp/ManagedAppConfigurationDecodingError) or if the error code is reserved, the device reports a generic error.

For more information on status reporting, see <doc://com.apple.documentation/documentation/DeviceManagement/leveraging-the-declarative-management-data-model-to-scale-devices>, and <doc://com.apple.documentation/documentation/devicemanagement/status-reports>.

---

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)