除了完成JSON和Model的轉換以外,KakaJSON內部還有不少實用的功能,有些也開放爲public接口了git
struct Cat { var age: Int = 0 let name: String = "" } guard let type = Metadata.type(Cat.self) as? ModelType, let properties = type.properties else { return } for property in properties { print(property.name, property.type, property.isVar, property.ownerType, property.offset) // age Int true Cat 0 // name String false Cat 8 }