Avatar
swiftbot BOT 6/3/2018 3:41 PM
(edited)
Author icon
koher
struct Foo { var count: Int = 0 var a: Int = 42 { didSet { print("Foo.a didSet: \(count)") count += 1 } } } struct Bar { var count: Int = 0 var foo: Foo = Foo() { didSet { print("Bar.foo didSet: \(count), \(foo.count)") count += 1 foo.count += 100 } } } var bar = Bar() bar.foo.a = -1
Version:
swift-4.1.1-RELEASE
Output:
Foo.a didSet: 0 Bar.foo didSet: 0, 1
Error: