yonat / MultiSlider

UISlider clone with multiple thumbs and values, range highlight, optional snap intervals, optional value labels, either vertical or horizontal.
MIT License
494 stars 113 forks source link

Set values from preferences... #79

Closed RaphaelLesourd closed 2 years ago

RaphaelLesourd commented 2 years ago

Hello, thanks for this SPM. In my app I m saving the current value of the slider at a Int in cloudKit to sync between devices. When I try to set the value for the sliders nothing happens. Am I doing it right?

 let slider: MultiSlider = {
        let slider = MultiSlider()
        slider.hasRoundTrackEnds = true
        slider.orientation = .horizontal
        slider.minimumValue = 0
        slider.maximumValue = 9
        slider.value = [2, 6]
        slider.snapStepSize = 1
// ... rest of the subview 
}

// Configure Prefs
func configureRange(with range: [Int]) {
        slider.value = range.map({ CGFloat($0) })
}

Thank you

umerirfan26 commented 2 years ago

@birkyboydesign how you solved this issue? @yonat same issue for me