BPKRangeSlider

public struct BPKRangeSlider : View

A view that displays a horizontal slider with two thumbs.

  • Creates a new instance of BPKRangeSlider.

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

    Declaration

    Swift

    public init(
        selectedRange: Binding<ClosedRange<Float>>,
        sliderBounds: ClosedRange<Float>,
        step: Float = 1,
        minSpacing: Float = 0,
        thumbnailLabels: ThumbnailLabels? = nil,
        onDragEnded: @escaping (ClosedRange<Float>) -> Void = { _ in }
    )

    Parameters

    selectedRange

    Binding of the selected range of the slider.

    sliderBounds

    The bounds of the slider.

    step

    The step size of the slider. Defaults to 1.

    minSpacing

    The minimum spacing between the two thumbs. Defaults to 0.

    thumbnailLabels

    The minimum spacing between the two thumbs. Defaults to 0.

    onDragEnded

    A closure that is called when the user stops dragging the slider.

  • Declaration

    Swift

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

    Declaration

    Swift

    public func trailingAccessibility(label: String) -> BPKRangeSlider
  • Sets the accessibility label for the leading thumb.

    Declaration

    Swift

    public func leadingAccessibility(label: String) -> BPKRangeSlider
  • Declaration

    Swift

    struct ThumbnailLabels