mardi 9 février 2016

Accessing static variables of a model class using reflection

I have a model class that contains some static variables and properties . In Runtime, I can get the properties ,

    let instance = entity.init()

    let mirror = Mirror(reflecting:instance)

    var propertyStrings = [String]()

    for (propertyName, childMirror) in mirror.children {

    }

But I want to get static variables of the class too.So how can I access static variables ? Here is my model class' structure :

class ActionModel: NSObject {

static let kLastModified = "LastModified"
static let kEntityName = "EntityName"
static let kIdentifier = "Id"


var lastModified: Int64
var entityName: String?
var identifier : PrimaryKeyString





Aucun commentaire:

Enregistrer un commentaire