In Swift 2.0, we can use Mirror(reflecting:)
to get some type information from an instance, e.g.
let stringMirror = Mirror(reflecting: "a string")
print(stringMirror.children)
However, is it possible to get information about a type without creating an instance? (For those of you who may want to know why I want this: The question is purely academic. Can it be done?)
My guess is no, because I think Mirror
is intended for use by playgrounds and is not an "official" reflection API.
Aucun commentaire:
Enregistrer un commentaire