2
我在JSON正文中接收請求的多個緯度和經度鍵。使用地幔將多個按鍵組合成單個屬性
{
...
latitude: "28.4949762000",
longitude: "77.0895421000"
}
我想將它們合併成一個單一CLLocation財產而將其轉化爲我的JSON模式:
#import <Mantle/Mantle.h>
@import CoreLocation;
@interface Location : MTLModel <MTLJSONSerializing>
@property (nonatomic, readonly) float latitude;
@property (nonatomic, readonly) float longitude; //These are the current keys
@property (nonatomic, readonly) CLLocation* location; //This is desired
@end
如何去實現一樣嗎?
它在[CHANGELOG]提及(https://github.com/Mantle/Mantle/blob/master/CHANGELOG.md#mapping-multiple-json-fields-to-a-single-property)但可能值得在README中找到一席之地! –