0Pricing
Swift Academy · Lesson

Composing Multiple Property Wrappers

Stacking property wrappers and understanding their initialization order.

Welcome

Multiple property wrappers can be applied to a single property. The order matters — outer wrappers wrap inner ones — and initialization order follows declaration order.

Stacking Wrappers

```swift @propertyWrapper struct A { var wrappedValue: Int { didSet { print("A") } } init(wrappedValue: Int) { self.wrappedValue = wrappedValue } } @propertyWrapper struct B { var wrappedValue: Int { didSet { print("B") } } init(wrappedValue: Int) { self.wrappedValue = wrappedValue } } struct S { @A @B var x = 0 } ```

All lessons in this course

  1. Creating a Custom Property Wrapper
  2. Projected Values with $binding
  3. @Published and Observation in Combine
  4. Composing Multiple Property Wrappers
← Back to Swift Academy