Protocol
ConfigProvider
A type that provides configuration values from a data source.
- iOS 18.0+
- macOS 15.0+
- tvOS 18.0+
- visionOS 2.0+
- watchOS 11.0+
protocol ConfigProvider : Sendable
Mentioned In
Overview
Configuration providers offer three access patterns for retrieving values:
Get methods: Synchronous access to cached, in-memory values.
Fetch methods: Asynchronous access that retrieves fresh values from the remote source.
Watch methods: Reactive access that provides an async sequence of updates.
For more details on the patterns, check out Choosing the access pattern.
Individual value access
Access specific configuration values using these methods:
Snapshot access
Access immutable snapshots of the provider’s state:
Implementation guidance
Immutable providers: Implement only the synchronous methods and use these convenience methods for the other access patterns:
Remote providers: Implement fetch methods to retrieve up-to-date values from network sources or external systems.
Dynamic providers: Implement watch methods to emit real-time updates from polling, file system monitoring, or other change detection mechanisms.
For a comprehensive guide on implementing your own custom provider, see Implementing a custom provider.
Topics
Required methods
Conveniences
Related guides
Relationships
Conforming Types