You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I invoke in cell custom action? For example I have viewController with func presentScreen() { let viewController = ViewController() present(viewController, animated: true, completion: nil) }
and want to call this method on tap a button from cell
The text was updated successfully, but these errors were encountered:
You can subscribe to button tap for example in configureCell Event, something like this:
manager.configure(MyCell.self){ cell, model, indexPath in// subscribe for button tap}
Remember that you need to unsubscribe in prepareForReuse or events will be duplicated. One useful pattern i found for myself is use RxSwift, subscribe to tap and make a DisposeBag, which disposes in prepareForReuse method, like so:
manager.configure(MyCell.self){ cell, model, indexPath in
cell.button.rx.tap.asDriver().drive(onNext:{[weak self]inself?.presentScreen()}).disposed(by: cell.reuseDisposeBag)}
How can I invoke in cell custom action? For example I have viewController with
func presentScreen() { let viewController = ViewController() present(viewController, animated: true, completion: nil) }
and want to call this method on tap a button from cell
The text was updated successfully, but these errors were encountered: