NYBlockExerciseCell.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // NYBlockExerciseCell.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2024/12/5.
  6. // Copyright © 2024 JCZ. All rights reserved.
  7. //
  8. #import "NYBlockExerciseCell.h"
  9. @interface NYBlockExerciseCell ()
  10. @property (nonatomic, readwrite, strong) NYBlockExerciseItemModel *viewModel;
  11. @end
  12. @implementation NYBlockExerciseCell
  13. #pragma mark - PublicMethods
  14. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  15. static NSString *ID = @"NYBlockExerciseCell";
  16. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  17. NYBlockExerciseCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  18. if (!cell) cell = [self rq_viewFromXib];
  19. return cell;
  20. }
  21. - (void)bindViewModel:(NYBlockExerciseItemModel *)viewModel {
  22. self.viewModel = viewModel;
  23. RAC(self.leftStr_label, text) = [[RACObserve(viewModel, leftStr) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal];
  24. RAC(self.right_btn, selected) = [[RACObserve(viewModel, isfinish) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal];
  25. RAC(self.progress_view, progress) = [[RACObserve(viewModel, progress) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal];
  26. RAC(self.progress_label, text) = [[RACObserve(viewModel, progressStr) deliverOnMainThread] takeUntil:self.rac_prepareForReuseSignal];
  27. }
  28. #pragma mark - SystemMethods
  29. - (void)awakeFromNib {
  30. [super awakeFromNib];
  31. }
  32. @end