I am new on RxSwift and I am trying to implement UITableView with it. I successfully implemented UITableView cell with rx.items and now I need to use didSelect method.
My problem is; my first cell selection, it called only once and I printed item. But after the first selection tableView.rx.modelSelected called multiple times.
What is the reason for it? How can I prevent from this?
Thanks.
func showContactListView() {
UIView.transition(with: self.view, duration: 0.5, options: UIViewAnimationOptions.curveEaseIn,
animations: {self.view.addSubview(self.contactSelectionView)}, completion: nil)
self.selectEmployeeFromList()
}
func selectEmployeeFromList() {
self.contactSelectionView.tableView.rx.modelSelected(Employee.self)
.subscribe(onNext: { item in
print(item)
self.contactSelectionView.removeFromSuperview()
}).disposed(by: self.disposeBag)
}