I am trying to get a list of all properties on a struct.
I used this code:
struct MyBanana {
var b: String?
}
Mirror(reflecting: MyBanana.self).children.isEmpty // returns true
Why is my .children
collection empty?
I need to be able to get these from a type rather than an instance.
Aucun commentaire:
Enregistrer un commentaire