vendredi 5 juin 2015

How to user reflection with Core Data and Swift

I'm trying to use reflection in Swift with Core Data entities, but when I execute the following code, my reflected var has only a reference for a super class, it didn't have a reference for any of it's attributes.

func printProperties() {
    let mirror = reflect(self)
    for var i = 0; i < mirror.count; i++ {
        let (propertyName, childMirror) = mirror[i]
        println("property name: \(propertyName)")
        println("property value: \(childMirror.value)")
    }
}

Does anyone have some idea why this happens?





Aucun commentaire:

Enregistrer un commentaire