In your example, when `Foo` is a class, then `A` does not see a mutation since 
the storage is out-of-line. When `Foo` is a struct, it is stored in-line and a 
mutation does mutate `A`.

In other words, when what’s stored in `A` is a reference, the reference itself 
does not get mutated when you mutate your `Foo`. If you change the statement in 
your loop to `a.foo = Foo()`, you’ll see that the `didSet` gets invoked again.

Cheers,
Guillaume Lessard

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to