dimanche 26 juillet 2015

Get name of property with reflection

In Swift 2.0 I'm looking for a way to get a property by reflection, so I don't have to rely on string constants for various functionality, such as Cocoa Bindings.

However, the documentation for the Mirror class is unclear if it's possible to do something in the line of:

let myPropertyString = getName(myObject.myProperty) using Reflection.

Is this possible in Swift today? And if so, how would one go about doing it?





Aucun commentaire:

Enregistrer un commentaire