Skip to content

Instantly share code, notes, and snippets.

@tilltue
Created June 28, 2018 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tilltue/2be6e67fc7d5e0c03588d6d86c0a1f7a to your computer and use it in GitHub Desktop.
Save tilltue/2be6e67fc7d5e0c03588d6d86c0a1f7a to your computer and use it in GitHub Desktop.
뷰컨트롤러와 코디네이터 연결 부분
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