// // RQPayPriceHeaderView.m // jiaPei // // Created by 张嵘 on 2022/6/9. // Copyright © 2022 JCZ. All rights reserved. // #import "RQPayPriceHeaderView.h" @interface RQPayPriceHeaderView () @property (nonatomic, readwrite, strong) RQPayPriceHeaderGroupViewModel *viewModel; @property (weak, nonatomic) IBOutlet UILabel *priceLabel; @end @implementation RQPayPriceHeaderView + (instancetype)headerViewWithTableView:(UITableView *)tableView { static NSString *ID = @"RQPayPriceHeaderView"; RQPayPriceHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:ID]; if (header == nil) { header = [self rq_viewFromXib]; } return header; } - (void)bindViewModel:(RQPayPriceHeaderGroupViewModel *)viewModel { _viewModel = viewModel; RAC(self.priceLabel, text) = [[RACObserve(viewModel.typeModel, dictValue) map:^id _Nullable(id _Nullable value) { if ([viewModel.typeModel.dictValue containsString:@","]) { return [viewModel.typeModel.dictValue componentsSeparatedByString:@","].firstObject; } else { return viewModel.typeModel.dictValue; } }] takeUntil:self.rac_prepareForReuseSignal]; } @end