Is there a way to set associated objects in Swift?
Here is a simple but complete example derived from jckarter’s answer. It shows how to add a new property to an existing class. It does it by defining a computed property in an extension block. The computed property is stored as an associated object: import ObjectiveC // Declare a global var to produce a unique … Read more