This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// An action that updates a value stored in the environment. | |
| /// | |
| /// ## Overview | |
| /// | |
| /// Use an `Updater` to allow descendant views to modify a value owned by | |
| /// an ancestor view, without passing Bindings or specific update actions for each property. | |
| /// The updater accepts a ``WritableKeyPath`` and a new value, then applies | |
| /// the change through a closure you provide at initialization. | |
| /// | |
| /// ### Setting up the updater |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// The current phase of the asynchronous loading operation. | |
| enum AsyncContentPhase<Value: Sendable> { | |
| /// No value is loaded yet. | |
| case empty | |
| /// The value loaded successfully. | |
| case success(Value) | |
| /// The load operation failed with an error. | |
| case failure(any Error) | |
| /// The loaded value, if any. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// A ShapeStyle that adapts dynamically based on the environment's ColorScheme | |
| /// | |
| /// This exists as a basic example of how to apply a @ContentBuilder to ShapeStyles | |
| struct AdaptiveStyle<Light: ShapeStyle, Dark: ShapeStyle>: ShapeStyle { | |
| let light: Light | |
| let dark: Dark | |
| @ContentBuilder | |
| func resolve(in environment: EnvironmentValues) -> some ShapeStyle { | |
| if environment.colorScheme == .light { |
OlderNewer