Entry()
Creates an environment values, transaction, container values, or focused values entry.
Declaration
@attached(accessor) @attached(peer, names: prefixed(__Key_)) macro Entry()Mentioned in
Environment Values
Create EnvironmentValues entries by extending the EnvironmentValues structure with new properties and attaching the @Entry macro to the variable declarations:
extension EnvironmentValues {
@Entry var myCustomValue: String = "Default value"
@Entry var anotherCustomValue = true
}Transaction Values
Create Transaction entries by extending the Transaction structure with new properties and attaching the @Entry macro to the variable declarations:
extension Transaction {
@Entry var myCustomValue: String = "Default value"
}Container Values
Create ContainerValues entries by extending the ContainerValues structure with new properties and attaching the @Entry macro to the variable declarations:
extension ContainerValues {
@Entry var myCustomValue: String = "Default value"
}Focused Values
Since the default value for FocusedValues is always nil, FocusedValues entries cannot specify a different default value and must have an Optional type.
Create FocusedValues entries by extending the FocusedValues structure with new properties and attaching the @Entry macro to the variable declarations:
extension FocusedValues {
@Entry var myCustomValue: String?
}