Skip to content

Instantly share code, notes, and snippets.

@isaac-weisberg
Last active April 17, 2021 10:31
Show Gist options
  • Save isaac-weisberg/b53d460394f6f18f3cb7b1a7d0c595ce to your computer and use it in GitHub Desktop.
Save isaac-weisberg/b53d460394f6f18f3cb7b1a7d0c595ce to your computer and use it in GitHub Desktop.
class TransactionTableViewModel {
// ... omitted ...
init(di: DI) {
self.transactionViewModels = di.transactionListService.getTransactionModels()
.map { transactionModel -> TransactionCellViewModel in
if transactionModel.isPendingAccept {
let viewModel = TransactionInfoWAcceptViewModel(model: transactionModel)
viewModel.acceptButtonTap
.map { _ in
transactionModel.id
}
.bind(to: navigation.showTransactionAcceptScreen)
.disposed(by: viewModel.disposeBag)
return .infoPendingAccept(viewModel)
}
let viewModel = TransactionInfoCellViewModel(model: transactionModel)
return .info(viewModel)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment