Property Wrappers are a feature of Swift 5.1 and beyond. Should be tagged onto questions using `@` to mark a Property Wrapper. Should not be used for `@` referring to Objective-C interoperability (e.g. @IBAction).
Property Wrappers are a feature of Swift 5.1 and beyond. Should be tagged onto questions using @
to mark a Property Wrapper. Should not be used for @
referring to Objective-C interoperability (e.g. @IBAction).
Property wrappers can be defined by using struct
, class
, or enum
. It can also used when declaring properties within those types.
Uses:
- Constraining Values
- Transforming Values on Property Assignment
- Changing Synthesized Equality and Comparison Semantics
- Auditing Property Access
References
- See more info at Property Wrappers - Swift Documentation.
- See more info at Swift Property Wrappers - NSHipster.
- See examples at Understanding Property Wrappers in Swift By Examples.
- From
SE-0258
Swift Evolution proposal, found here on GitHub.