How to specify child objects type in an NSArray with Mantle

后端 未结 5 1591
無奈伤痛
無奈伤痛 2021-01-31 17:30

If I have a dictionary like

{
  name: \"Bob\",
  cars: [
    { make: \"ford\", year: \"1972\" },
    { make: \"mazda\", year: \"2000\" }
  ],
}

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-31 18:26

    +[NSValueTransformer mtl_JSONArrayTransformerWithModelClass:]
    

    This method is deprecated. New method is:

      + (NSValueTransformer *)carsTransformer
        {
            return [MTLJSONAdapter arrayTransformerWithModelClass:[CarsModel class]];
        }
    

提交回复
热议问题