Allow property observers to observe subproperties as well
| Originator: | DeFrenZ | ||
| Number: | rdar://22855672 | Date Originated: | 25-Sep-2015 02:40 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Summary:
In a similar fashion to KVO, allow for property observers (willSet, didSet) to be notified on changes of keypaths and not only direct properties. Of course that would only be allowed for visible properties according to their access modifiers.
e.g.
struct Foo {
var baz: Int = 0
}
class Bar {
var foo: Foo = Foo() {
didSet base { print(“new baz: \(foo.baz)”) }
}
}
let bar = Bar()
bar.foo.baz = 2 // this would print
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!