Geen omschrijving

FKCollectReform.m 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. //
  2. // FKCollectReform.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 15/10/15.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FKCollectReform.h"
  9. @implementation FKCollectReform
  10. + (CollectViewModel *)parseCollectViewModel:(NSDictionary *)json {
  11. if ([json isKindOfClass:[NSDictionary class]] && json[@"data"] != [NSNull null]) {
  12. CollectViewModel *viewModel = [[CollectViewModel alloc] init];
  13. viewModel.itemsArray = [FKCollectReform parseItems:json[@"data"]];
  14. return viewModel;
  15. }
  16. return nil;
  17. }
  18. + (NSMutableArray *)parseItems:(NSDictionary *)json {
  19. if ([json isKindOfClass:[NSDictionary class]]) {
  20. NSMutableArray *array = [NSMutableArray array];
  21. CollectItem *item;
  22. for (NSDictionary *dict in json[@"list"]) {
  23. item = [[CollectItem alloc] init];
  24. [item mts_setValuesForKeysWithDictionary:dict];
  25. item.isCollect = YES;
  26. [array addObject:item];
  27. }
  28. return array;
  29. }
  30. return nil;
  31. }
  32. @end