Swift获取属性列表和ivar列表
2018-06-22 本文已影响0人
很着急丶
swift 也可以通过运行时获取类的属性列表和 ivar 列表
新建一个model 类 并且添加属性

下面是获取 Person 这个类的属性列表

获取ivar列表

用private 描述的属性 能获取到对应的ivar 可选的基本数据 也能获取到对应的ivar 但是获取不到对应的


demo地址:https://github.com/houzhijie/SwiftDemo.git
swift 也可以通过运行时获取类的属性列表和 ivar 列表
新建一个model 类 并且添加属性
下面是获取 Person 这个类的属性列表
获取ivar列表
用private 描述的属性 能获取到对应的ivar 可选的基本数据 也能获取到对应的ivar 但是获取不到对应的
demo地址:https://github.com/houzhijie/SwiftDemo.git