Property wrapper implementation requirements (PropertyWrappers)
Overview
If a type is marked with the @propertyWrapper attribute, it must meet certain requirements to be a valid property wrapper.
First, all property wrapper types must have a property named wrappedValue. This property cannot be static and must have the same access level as the property wrapper type. If the property wrapper provides a projectedValue property, it is subject to the same requirements.
Second, none of a property wrapper’s initializers may be failable. Additionally, if a property wrapper initializer has a wrappedValue parameter, the type of that parameter must either be the same as the type of the wrappedValue property or an @autoclosure of that type.
See Also
@dynamicCallable implementation requirements (DynamicCallable)Add @preconcurrency import (AddPreconcurrencyImport)Always enabled availability domains (AlwaysAvailableDomain)Argument matching for trailing closures (TrailingClosureMatching)Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)Captures in a `@Sendable` closure (SendableClosureCaptures)Compilation caching (CompilationCaching)Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)Cross-isolation data race (RegionIsolationCrossIsolationDataRace)Deprecated declaration warnings (DeprecatedDeclaration)Deprecated implementation-only imports (ImplementationOnlyDeprecated)Dynamic exclusivity (DynamicExclusivity)Embedded Swift language restrictions (EmbeddedRestrictions)