Created
June 28, 2018 14:53
-
-
Save tilltue/2be6e67fc7d5e0c03588d6d86c0a1f7a 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 ListOfPurchasesViewController: BaseTestableViewController,RxTableViewBindProtocol { | |
//... | |
var viewModel: ListOfPurchasesViewModel! | |
var listOfPurchasesCoordinator: ListOfPurchasesCoordinator! | |
} | |
extension ListOfPurchasesViewController { | |
func bindViewModel() { | |
//... | |
//UI action | |
self.bindProperty.selectedCell.subscribe(onNext: { [weak self] (_,viewModel) in | |
if let item = Realm.getObject(type: Item.self, filter: "id == '\(viewModel.identity)'") { | |
DispatchQueue.main.async { | |
self?.listOfPurchasesCoordinator.presentModifyView(item: item) | |
} | |
} | |
}).disposed(by: disposeBag) | |
self.addButton.rx.throttleTap.subscribe(onNext: { [weak self] _ in | |
self?.listOfPurchasesCoordinator.presentInputView() | |
}).disposed(by: disposeBag) | |
self.detailCustomInfoLabel.addTapGesture().subscribe(onNext: { [weak self] _ in | |
if let viewModel = self?.viewModel { | |
self?.listOfPurchasesCoordinator.presentCustomsInformationView(viewModel: viewModel) | |
} | |
}).disposed(by: disposeBag) | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment