1234567891011121314151617181920212223242526272829303132333435363738394041 |
- //
- // FKCollectReform.m
- // FirstLink
- //
- // Created by ascii on 15/10/15.
- // Copyright © 2015年 FirstLink. All rights reserved.
- //
- #import "FKCollectReform.h"
- @implementation FKCollectReform
- + (CollectViewModel *)parseCollectViewModel:(NSDictionary *)json {
- if ([json isKindOfClass:[NSDictionary class]] && json[@"data"] != [NSNull null]) {
- CollectViewModel *viewModel = [[CollectViewModel alloc] init];
- viewModel.itemsArray = [FKCollectReform parseItems:json[@"data"]];
-
- return viewModel;
- }
- return nil;
- }
- + (NSMutableArray *)parseItems:(NSDictionary *)json {
- if ([json isKindOfClass:[NSDictionary class]]) {
- NSMutableArray *array = [NSMutableArray array];
-
- CollectItem *item;
- for (NSDictionary *dict in json[@"list"]) {
- item = [[CollectItem alloc] init];
- [item mts_setValuesForKeysWithDictionary:dict];
-
- item.isCollect = YES;
- [array addObject:item];
- }
- return array;
- }
- return nil;
- }
- @end
|