TabelView Delegate methods using RxSwift

Mehreen picture Mehreen · Mar 30, 2017 · Viewed 7.6k times · Source

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?

Answer

Aaqib Hussain picture Aaqib Hussain · Jun 27, 2018

Actually you can. Try this:

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