chicio/RangeUISlider

changeLeftKnob(value:), changeRightKnob(value:) and Rxswift is not working.

ChanSeulCho opened this issue · 0 comments

Functions, changeLeftKnob(value:), changeRightKnob(value:), is not working.
Each function does not change the defaultValueLeftKnob value and the defaultValueRightKnob value.
Also, is it not possible to use this library by wrapping RxSwift?
The code below is not working

extension Reactive where Base: RangeUISlider {
  public var upperValue: ControlProperty<CGFloat> {
    let source = self.base.rx.methodInvoked(#selector(setter: self.base.defaultValueRightKnob))
      .compactMap { $0.first as? CGFloat }
      .map { $0.rounded() }
      .distinctUntilChanged()
    
    let bindingObserver = Binder(self.base) { (slider, value: CGFloat) in
      slider.defaultValueRightKnob = value
    }
    
    return ControlProperty(values: source, valueSink: bindingObserver)
  }
  
  public var lowerValue: ControlProperty<CGFloat> {
    let source = self.base.rx.methodInvoked(#selector(setter: self.base.defaultValueLeftKnob))
      .compactMap { $0.first as? CGFloat }
      .map { $0.rounded() }
      .distinctUntilChanged()
    
    let bindingObserver = Binder(self.base) { (slider, value: CGFloat) in
      slider.defaultValueLeftKnob = value
    }

    return ControlProperty(values: source, valueSink: bindingObserver)
  }
}