func LogIvarList(classString:String){
print("\n\n ********** \(classString) IvarList ****************\n")
var count:UInt32 = 0
let list = class_copyIvarList(NSClassFromString(classString), &count)
for i in 0 ..< Int(count) {
let ivar = list![i]
let name = ivar_getName(ivar)
let type = ivar_getTypeEncoding(ivar)
print( String(cString: name!),"-----",String(cString: type!),"\n")
}
}
func LogPropertyList(classString:String){
print("\n\n ********** \(classString) PropertyList ****************\n")
var count:UInt32 = 0
let list = class_copyPropertyList(NSClassFromString(classString), &count)
for i in 0 ..< Int(count) {
let property = list![i]
let name = property_getName(property)
let type = property_getAttributes(property)
print( String(cString: name!),"------",String(cString: type!),"\n")
}
}
网友评论