Skip to content

Snapping to Anchor Points? #8

Description

@futnuh

Is it possible to have the thumb snap to one of the anchor points? I browsed the example and didn't see anything obvious in terms of exposed properties that would allow this. I then tried setting the slider value in the following callback:

    func sliderDidEndSwiping() {
        print("Slider did end swiping")
        let newSliderValue = sliderController.sliderValue
        // calculate closest anchor value based on newSliderValue
        sliderController.setSlider(value: closestAnchorValue, animated: false)
        print(sliderController.sliderValue)
    }

Unfortunately, it seems that after this method gets called, the value immediately goes back to "newSliderValue" (i.e., even before the next view layout). I could call setSlider on a delayed call ... but that seems like a real hack. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions