Open selfishout opened 6 years ago
extension Reactive where Base: PinterestSegment {
/// Bindable sink for `titles ` property.
public var titles: Binder<[String]> {
return Binder(base) { segment, titles in
segment.titles = titles
}
}
}
Thanks but how could I bind it to PinterestSegment View as I have trying to do like this : output.services.drive(newsSegment.rx.titles) I've got an error : Generic parameter 'Self' could not be inferred
How could I get rid of this annoying error ? Thanks
Actually, it works
Driver.of(["it", "works", "!"])
.drive(segment.rx.titles)
.disposed(by: bag)
I believe the problem is that output.services
is not a Driver<[String]>
type.
P.S.: And since I'm here, I guess I gonna throw another useful extension for future readers. 😄
extension Reactive where Base: PinterestSegment {
public var valueChange: Observable<Int> {
return Observable.create { observable in
self.base.valueChange = { index in
observable.onNext(index)
}
return Disposables.create()
}
}
public var itemSelected: ControlEvent<Int> {
return ControlEvent(events: valueChange)
}
}
Hi there I want to populate PinterestSegment reactively from network but I don't know how to get that
Actually output is a transformation of input to something intelligible for the view and all of those transformation done into ViewModel :
for news which binded to tableView everything works perfectly but when I try binding services (from Service Model) to PinterstSegment , I've got an error which present in above but for the sake of integrity the error is :
Cannot invoke 'drive' with an argument list of type '([String])'