Is there a way to use Mirror to enumerate the static members of a class?
A good example of this is the UnitLength class that has class variables like @NSCopying class var meters: UnitLength { get }
The UnitLength class acts much like an Objective C sort of enumeration (in that all of the UnitLength units are class vars on the UnitLength class.
I was hoping to use reflection (Mirror) to grab each of the units at runtime to build the list (manually putting them in my code is hardly “DRY”).
From some experimentation with the Mirror capabilities, I’ve not been able to find these class vars. Is there some trick I’m missing?
Aucun commentaire:
Enregistrer un commentaire