> On Sep 4, 2016, at 8:11 AM, adelzhang via swift-users <swift-users@swift.org> > wrote: > > Swfit encourage to override the property observer. But when we change the own > property in Child class's `didSet` observer, that would cause infinite loop:
I’m not a Swift guru, but that seems like a bug to me. The book explicitly says that it’s legal for a didSet block to set the property value, with no caveats about overridden properties. You should be able to work around this by having the subclass override the `set` block instead, and pass the modified value to the superclass. (It’s probably slightly more efficient too.) —Jens _______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users