1234567891011121314151617181920212223242526272829303132333435 |
- //
- // RQCommonCollectionViewModel.m
- // YueXueChe
- //
- // Created by 张嵘 on 2018/12/19.
- // Copyright © 2018 lee. All rights reserved.
- //
- #import "RQCommonCollectionViewModel.h"
- @implementation RQCommonCollectionViewModel
- - (void)initialize {
- [super initialize];
-
- @weakify(self);
- /// 选中cell的命令
- /// UI Test
- self.didSelectCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(NSIndexPath *indexPath) {
- @strongify(self);
- RQCommonGroupViewModel *groupViewModel = self.dataSource[indexPath.section] ;
- RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
-
- if (itemViewModel.operation) {
- /// 有操作执行操作
- itemViewModel.operation();
- }else if(itemViewModel.destViewModelClass){
- /// 没有操作就跳转VC
- Class viewModelClass = itemViewModel.destViewModelClass;
- RQBaseViewModel *viewModel = [[viewModelClass alloc] initWithServices:self.services params:@{RQViewModelTitleKey:itemViewModel.title}];
- [self.services pushViewModel:viewModel animated:YES];
- }
- return [RACSignal empty];
- }];
- }
- @end
|