I have a view that has to be able to rebind to a new view-model periodically: that means removing the old bindings as well as hooking up the new ones. I have a working solution, but it's not thread-safe and I wonder if there's a more idiomatic way to do the same:
var disposeBag = CompositeDisposable()
func bind(viewModel: TopicProgressViewModel) {
disposeBag.dispose()
disposeBag = CompositeDisposable()
disposeBag += self.reactive.isHidden <~ viewModel.isHidden
disposeBag += height <~ viewModel.height
disposeBag += label.reactive.text <~ viewModel.label
disposeBag += progress.reactive.progress <~ viewModel.progressFraction
}