// // RQTimeSingleCell.m // jiaPei // // Created by 张嵘 on 2022/11/25. // Copyright © 2022 JCZ. All rights reserved. // #import "RQTimeSingleCell.h" @interface RQTimeSingleCell () @property (nonatomic, readwrite, strong) RQTimeSingleItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UIImageView *myTimeIcon; @property (weak, nonatomic) IBOutlet UILabel *myTimeLabel; @end @implementation RQTimeSingleCell #pragma mark - PublicMethods + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath { static NSString *ID = @"RQTimeSingleCell"; [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID]; RQTimeSingleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath]; if (!cell) cell = [self rq_viewFromXib]; return cell; } - (void)bindViewModel:(RQTimeSingleItemViewModel *)viewModel { self.viewModel = viewModel; RAC(self.myTimeIcon, image) = [[[RACObserve(viewModel, icon) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal] map:^id _Nullable(NSString *imageName) { return RQImageNamed(imageName); }]; RAC(self.myTimeLabel, text) = [[RACObserve(viewModel, title) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal]; } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } @end