如何在运行的时候动态获取到该属性的类型呢?
此方法获取属性的特性:property_copyAttributeValue
unsigned int a;
objc_property_t * result = class_copyPropertyList(object_getClass(k), &a);
for (unsigned int i = 0; i < a; i++) {
objc_property_t o_t = result[i];
NSLog(@"name: %@", [NSString stringWithFormat:@"%s", property_getName(o_t)]);
NSLog(@"att: %@", [NSString stringWithFormat:@"%s", property_getAttributes(o_t)]);
}2018-06-07 15:32:59.252063+0800 runtime[17026:450201] name: height_i
2018-06-07 15:32:59.252217+0800 runtime[17026:450201] att: Ti,V_height_i
2018-06-07 15:32:59.252316+0800 runtime[17026:450201] name: height_d
2018-06-07 15:32:59.252365+0800 runtime[17026:450201] att: Td,V_height_d
2018-06-07 15:32:59.252404+0800 runtime[17026:450201] name: height_f
2018-06-07 15:32:59.252434+0800 runtime[17026:450201] att: Tf,V_height_f
2018-06-07 15:32:59.252452+0800 runtime[17026:450201] name: weight
2018-06-07 15:32:59.252498+0800 runtime[17026:450201] att: T@"NSNumber",R,N,V_weight
2018-06-07 15:32:59.252518+0800 runtime[17026:450201] name: name
2018-06-07 15:32:59.252546+0800 runtime[17026:450201] att: T@"NSString",&,V_name
2018-06-07 15:32:59.252573+0800 runtime[17026:450201] name: family
2018-06-07 15:32:59.252612+0800 runtime[17026:450201] att: T@"NSString",&,V_family如上可以打印特性值:

image.png

image.png
官方文档为:* Declared Properties