BPKSlider

public struct BPKSlider : View

A view that displays a horizontal slider with a thumb that can be dragged to select a value.

  • Creates a new instance of BPKSlider.

    If the value is outside the bounds of the slider, it will be clamped to the bounds.

    Declaration

    Swift

    public init(
        value: Binding<Float>,
        sliderBounds: ClosedRange<Float>,
        step: Float = 1,
        onDragEnded: @escaping (Float) -> Void = { _ in }
    )

    Parameters

    value

    Binding of the value of the slider.

    sliderBounds

    The bounds of the slider.

    step

    The step size of the slider. Defaults to 1.

    onDragEnded

    A closure that will be called when the user stops dragging the slider.

  • Declaration

    Swift

    public var body: some View { get }
  • Sets the accessibility label for the thumb.

    Declaration

    Swift

    public func thumbAccessibility(label: String) -> BPKSlider