我有一个包含一些静态变量和属性的模型类.在运行时我可以获得属性;
let instance = entity.init() let mirror = Mirror(reflecting:instance) var propertyStrings = [String]() for (propertyName,childMirror) in mirror.children { }
但我也希望将类的静态变量作为列表.那么如何获取静态变量的名称和值列表呢?这是我的模型类的结构:
class ActionModel: NSObject { static let kLastModified = "LastModified" static let kEntityName = "EntityName" static let kIdentifier = "Id" var lastModified: Int64 var entityName: String? var identifier : PrimaryKeyString