how can i handle action of multiple button by combining them in RxSwift?
Hi, @Rico9260
Just merge them into one sequence e.g:
let o = Observable.of(button1.rx.tap, button2.rx.tap).merge()
i need to access the tag of button inside the subscribe call
let o = Observable.of(button1.rx.tap, button2.rx.tap).merge()
o.subscribe(onNext: {
//tag of button that is clicked
})
let tag1 = button1.rx.tap.map { [unowned self] _ in return self.button1.tag}
let tag2 = button2.rx.tap.map { [unowned self] _ in return self.button2.tag}
let tags = Observable.of(tag1, tag2).merge()
I think we can close this one 馃榾
I have five buttons in VC and four buttons maintains isSelected property
if either of the four button's isSelected is true I need to show the fifth button
otherwise i Need to hide it.
How can I achieve this ?
Most helpful comment
Hi, @Rico9260
Just merge them into one sequence e.g: