Property Wrappers or How Swift decided to become Java
summary
Shows concretely what Swift property wrappers do: implementable in Swift 5.1 to have the compiler synthesize access to a property via @propertyWrapper and a wrappedValue getter/setter, and expose the wrapper via $projectedValue. Builds examples that work: clamped numbers, trimmed strings, versioned history with timestamps, UserDefaults-backed properties, a caching wrapper for pure functions and an experimental GET-network wrapper that generates URLSession calls. Notes limits: wrappers cannot throw or annotate parameters today and can hurt readability if overused.
AI-written summary · about
