I don't see a cleaner solution for observing value change for a property on 
superclass:

class MyView: UIView {

        override var bounds: CGRect {
                didSet { 
                        self._clearCachedValues() 
                }
        }

}

Without didSet, you need to do this:

class MyView: UIView {

        override var bounds: CGRect {
                get { 
                        return super.bounds 
                }
                set { 
                        super.bounds = newValue
                        self._clearCachedValues() 
                }
        }

}

Which is just so painful to type out.

Krystof


> On May 19, 2016, at 8:37 AM, Tino Heth via swift-evolution 
> <[email protected]> wrote:
> 
> Because some posts explicitly stated the willSet/didSet-functionality should 
> be kept (and I mentioned the option of discarding them):
> My statement had the same background as Brent's — I expect there will be a 
> "cleaner" and more versatile replacement in the future, so "don't fix it if 
> it isn't broken, and will be replaced soon anyways" ;-)
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to