// // RASettingSectionModel.m // Apex And Drivers // // Created by Jack on 2018/9/12. // Copyright © 2018年 USAI. All rights reserved. // #import "RASettingSectionModel.h" #import "RASettingOptionModel.h" #import "RASettingSwitchModel.h" #import "RASettingActionModel.h" #import "RASettingAboutModel.h" #import "RASettingLinkModel.h" @implementation RASettingSectionModel - (void)setValue:(id)value forUndefinedKey:(NSString *)key { } - (void)setSettings:(NSArray *)settings { if (!settings) { _settings = nil; return; } NSMutableArray *arr = [NSMutableArray array]; for (NSDictionary *value in settings) { RASettingType type = [[value objectForKey:@"type"] intValue]; RASettingBaseModel *model = nil; switch (type) { case RASettingTypeOption: { model = [RASettingOptionModel new]; } break; case RASettingTypeSwitch: { model = [RASettingSwitchModel new]; } break; case RASettingTypeAction: { model = [RASettingActionModel new]; } break; case RASettingTypeAbout: { model = [RASettingAboutModel new]; } break; case RASettingTypeLink: { model = [RASettingLinkModel new]; } break; default: break; } if (model) { [model setValuesForKeysWithDictionary:value]; [arr addObject:model]; } } _settings = arr; } @end