These are my classes:
class Shape: NSObject {
var prop1:String?
let prop2:String = "Shape Default"
func printEverything(){
var reflection = reflect(self)
for var i = 0 ; i < reflection.count ; i++ {
var (prop,mirror) = reflection[i]
println(prop);
}
}
}
class Rect: Shape {
var prop3:String?
let prop4:String = "Rect Default"
func func2(){
// body2
}
}
var aRect = Rect()
aRect.printEverything()
However printEverything only showed: super, prop3, prop4. I was expecting to get the whole inheritance, namely: super, prop1, prop2, prop3, prop4, printEverything, func2.
Also, how can I set these property from the reflection?
Thanks
Aucun commentaire:
Enregistrer un commentaire