Slider

public struct Slider : View
extension Slider: Renderable

A view that displays a range of values, and a knob that allows selecting a value in the range.

  • Declaration

    Swift

    public var viewStore: ViewValues
  • Declaration

    Swift

    public var body: View { get }
  • Creates an instance that selects a value from within a range.

    The value of the created instance will be equal to the position of the given value within bounds, mapped into 0...1.

    Declaration

    Swift

    @available(tvOS, unavailable)
    public init(value: Binding<Float>, in bounds: ClosedRange<Float> = 0...1)

    Parameters

    value

    The selected value within bounds.

    bounds

    The range of the valid values. Defaults to 0...1.

  • Creates an instance that selects a value from within a range.

    The value of the created instance will be equal to the position of the given value within bounds, mapped into 0...1.

    Declaration

    Swift

    @available(tvOS, unavailable)
    public init(value: Binding<Float>, in bounds: ClosedRange<Float>, step: Float = 1)

    Parameters

    value

    The selected value within bounds.

    bounds

    The range of the valid values. Defaults to 0...1.

    step

    The distance between each valid value.

    label

    A View that describes the purpose of the instance.

  • Declaration

    Swift

    public func createView(context: Context) -> UIView
  • Declaration

    Swift

    public func updateView(_ view: UIView, context: Context)