I'm interested in binding a single Observable to multiple receivers. How can I achieve this concisely?
Currently, I have to resort to binding every property:
model.sectionEnabled.map{!$0}.bind(to: vc1.view.reactive.isHidden)
model.sectionEnabled.map{!$0}.bind(to: vc2.view.reactive.isHidden)
model.sectionEnabled.map{!$0}.bind(to: vc3.view.reactive.isHidden)
....
What if it would be possible to use the following construct?:
model.sectionEnabled.map{!$0}
.bind(to: vc1.view.reactive.isHidden)
.bind(to: vc2.view.reactive.isHidden)
.bind(to: vc3.view.reactive.isHidden)
.bind(to:.......
Is it already possible to do such binding with the current implementation of the framework?
Maybe this is what you want:
if let disabled = model.sectionEnabled.map{!$0} {
for vc in [vc1, vc2, vc3] {
disabled.bind(to: vc.view.reactive.isHidden)
}
}