Last active
April 13, 2021 20:11
-
-
Save isaac-weisberg/5ef4685b9cb9f296dfa44b6f00b017ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TransactionTableViewModel { | |
typealias DI = HasTransactionListService | |
let transactionViewModels: [TransactionCellViewModel] | |
class NavigationEvents { | |
let showTransactionAcceptScreen = PublishRelay<String>() | |
} | |
let navigation = NavigationEvents() | |
init(di: DI) { | |
self.transactionViewModels = di.transactionListService.getTransactionModels() | |
.map { transactionModel in | |
let viewModel = TransactionCellViewModelImpl(model: transactionModel) | |
viewModel.acceptButtonTap | |
.map { _ in | |
transactionModel.id | |
} | |
.bind(to: navigation.showTransactionAcceptScreen) | |
.disposed(by: viewModel.disposeBag) | |
return viewModel | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment