I'm very new to RxSwift and RxCocoa. I want to set image to UIButton by using RxCocoa.
settingButton.rx.image(for: .normal).onNext(UIImage.init(named: "closeButton"))
Any one have idea how to set image to UIButton? Am i doing right?
I don't recommend you to set a button's image reactively. If you don't have any special reasons for doing this, do it the normal (imperative) way:
settingButton.setImage(UIImage.init(named: "closeButton"), for: .normal)
Here's how you do it reactively, no need for asObserver
and stuff:
button.rx.image().onNext(UIImage.init(named: "closeButton"))