如自定义映射规则范例中对parent的映射操作,假设需映射的json中该值的名称为parent_list, 我该如果同时描述两种映射规则?
deyfvvtc1#
func mapping(mapper: HelpingMapper) { mapper <<< self. parent <-- ["parent", "parent_list"] }
zzoitvuj2#
func mapping(mapper: HelpingMapper) { mapper <<< self. parent <-- (["parent", "parent_list"], TransformOf<TypeA, TypeB>(fromJSON: { object_b -> TypeA in return TypeA.init(from: object_b) }, toJSON: { object_a -> TypeB in return TypeB.init(from: object_a) })) }
2条答案
按热度按时间deyfvvtc1#
zzoitvuj2#