Hi, in my custom cell I have something like this:
var title: String? {
get {
return titleLabel.text
}
set {
titleLabel.text = newValue?.uppercased()
titleLabel.addTextSpacing()
// maybe something more
}
}
and in order to use (in a reactive way) in my VC I have to use this long code
viewModel
.titleObs // Observable<String?>
.subscribe(onNext: { title in
cell.title = title
})
.addDisposableTo(cell.bag)
I’m not sure if it was in the book, maybe I missed it out, but is it possible to create a custom receiver for bind(to:) method? I know I can bind titleObs directly to titleLabel.rx.text, but I need to add some more work. even more, than I gave here in the example.
I would like to make something like this:
// VC
viewModel
.titleObs // Observable<String?>
.bind(to: cell.title)
.addDisposableTo(cell.bag)
// Cell
var title: Binder<String?> {
titleLabel.text = newValue?.uppercased()
titleLabel.addTextSpacing()
// maybe something more
}