0
我有一個對象,它具有多個對象如何獲得鬍子
fields:[
{
safeName: 'status',
accessorName: 'Status',
type: {name: 'String', doc: 'String', code: '\'String\''},
field: {type: 'string', description: 'pet status in the store', enum: ['available', 'pending', 'sold']}
},
{
safeName: 'code',
accessorName: 'Code',
type: {name: 'NSInteger', doc: 'NSInteger', code: '\'NSInteger\'' },
field: {type: 'integer', format: 'int32'}
},
...
]
我需要檢查枚舉值獲取一個節點的值
輸出應該是
當enum
存在於字段
instance.status = Order.Status(rawValue: (sourceDictionary["status"] as? String) ?? "")
當enum is not present
在field
對象
instance.code = Decoders.decodeOptional(clazz: NSInteger.self, source: sourceDictionary["code"])