1. 获取property

    • 用class_copyPropertyList遍历了modelClass的property
    • mtl_copyPropertyAttributes把property的属性字符串解析成struct结构,参考ojbc rutime
  2. 宏@onExit

#define onExit \
try {} @finally {} \
__strong mtl_cleanupBlock_t metamacro_concat(mtl_exitBlock_, __LINE__) __attribute__((cleanup(mtl_executeCleanupBlock), unused)) = ^

其中用到了 __attribute__((cleanup)()) 这个编译指令表示在定义的变量所在的定义scope结束的时候执行一个方法。 参考资料