123456789101112131415161718192021222324252627282930313233343536373839 |
- //
- // YMChatNotificationSectionViewModel.m
- // MSYOUPAI
- //
- // Created by YoMi on 2024/2/21.
- // Copyright © 2024 MS. All rights reserved.
- //
- #import "YMChatNotificationSectionViewModel.h"
- @interface YMChatNotificationSectionViewModel()
- /// 分组头标题
- @property (nonatomic, copy, readwrite) NSString *sectionHeader;
- /// 分组脚标题
- @property (nonatomic, copy, readwrite) NSString *sectionFooter;
- /// 是否隐藏分组头
- @property (nonatomic, assign, readwrite) BOOL isHideSectionHeader;
- /// 是否隐藏分组脚
- @property (nonatomic, assign, readwrite) BOOL isHideSectionFooter;
- /// 分组数据
- @property (nonatomic, strong, readwrite) NSArray <YMChatNotificationCellViewModel*>*rowDataArray;
- @end
- @implementation YMChatNotificationSectionViewModel
- - (void)ym_initialize{
- [super ym_initialize];
- NSDictionary *dic = [self.params dictionaryValueForKey:ParamsModel defaultValue:@{}];
- self.sectionHeader = [dic stringValueForKey:@"sectionHeader" defaultValue:@""];
- self.sectionFooter = [dic stringValueForKey:@"sectionFooter" defaultValue:@""];
- self.isHideSectionHeader = [dic boolValueForKey:@"isHideSectionHeader" defaultValue:NO];
- self.isHideSectionFooter = [dic boolValueForKey:@"isHideSectionFooter" defaultValue:NO];
- self.rowDataArray = [[dic arrayValueForKey:@"dataSource" defaultValue:@[]].rac_sequence map:^(NSDictionary * _Nullable dic) {
- YMChatNotificationCellViewModel *viewModel = [[YMChatNotificationCellViewModel alloc]initWithParams:@{
- ParamsModel:dic
- }];
- return viewModel;
- }].array;
- }
- @end
|