[swift-evolution] Custom didSet methods

James Campbell james at supmenow.com
Tue Jan 12 05:24:24 CST 2016


When declaring a collection, it would be nice to have a way of knowing when
an item is set/added and removed.

For example you could trigger a layer to be added to the layer hiearchy.

var shapeLayers: [CAShapeLayer] {

didAdd(item) {
 addSubLayer(item)
}

willRemove(item){
 item.removeFromSuperlayer()
}
}

-- 
 Wizard
james at supmenow.com
+44 7523 279 698
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160112/10ff94ab/attachment.html>


More information about the swift-evolution mailing list