I recently found myself in the position where I am happily using a protocol, and needed to work with equality in a context that can be summed up as: var currentObject: MyProtocol = Thing1() { willSet{ if newValue != currentObject { //perform costly operation } } (But really, equality is everywhere. Want to get the […]
Aug 9 2018
Protocols and Equality
I recently found myself in the position where I am happily using a protocol, and needed to work with equality in a context that can be summed up as: var currentObject: MyProtocol = Thing1() { willSet{ if newValue != currentObject { //perform costly operation } } (But really, equality is everywhere. Want to get the […]
By Extelligent Cocoa • Application Design, Design Patterns •