cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/ProvinceCityArea(省市区)/CYHProvinceCityAreaHelper.m
2023-07-27 09:20:00 +08:00

40 lines
940 B
Objective-C

//
// CYHProvinceCityAreaHelper.m
// TreeHole
//
// Created by iOS on 2023/2/15.
// Copyright © 2023 CYH. All rights reserved.
//
#import "CYHProvinceCityAreaHelper.h"
@implementation CYHProvinceCityAreaHelper
- (instancetype)init {
if (self = [super init]) {
[self loadLocalProvinceCityAreaJson];
}
return self;
}
- (void)loadLocalProvinceCityAreaJson {
NSString *localPath = [NSBundle.mainBundle pathForResource:@"ProvinceCityArea" ofType:@"geojson"];
NSData *jsonData = [NSData dataWithContentsOfFile:localPath];
id jsonArray = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:nil];
_provinceCityAreaModels = [NSArray yy_modelArrayWithClass:CYHProvinceCityAreaModel.class json:jsonArray];
}
@end
@implementation CYHProvinceCityAreaModel
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{
@"children" : [self class],
};
}
@end