7
votes

I am using RxSwift for TableView.I need to calculate height of dynamic cells previously I did it in WillDisplayCell delegate method. I don't know how to bind TableView Delegate methods with RxSwift. Can any one help?

2
It may be helped you- raywenderlich.com/138547/… - iDeveloper
Thanks, but I need more precise answer. - Mehreen
Hi Mehreen, Is your issue resolved ? - iDeveloper
Yes. It has been resolved. - Mehreen
Great , Enjoy coding... - iDeveloper

2 Answers

23
votes

Actually you can. Try this:

       tableView.rx
        .willDisplayCell
        .subscribe(onNext: { cell, indexPath in
   //Do your will display logic
           })
        .disposed(by: disposeBag)
9
votes

Conform your View Controller

class YourViewController: UIViewController, UITableViewDelegate

Then add this in viewDidLoad()

tableView.rx.setDelegate(self).addDisposableTo(disposeBag)

then you write UITableViewDelegate methods.