Initializer
init(value:in:onEditingChanged:minimumValueLabel:maximumValueLabel:label:)
Creates a slider to select a value from a given range, which displays the provided labels.
Declaration
宣言
Available when Label
conforms to View
and ValueLabel
conforms to View
.
Parameters
パラメータ
value
The selected value within bounds
.
bounds
The range of the valid values. Defaults to 0...1
.
onEditingChanged
A callback for when editing begins and ends.
minimumValueLabel
A view that describes bounds.lowerBound
.
maximumValueLabel
A view that describes bounds.lowerBound
.
label
A View
that describes the purpose of the instance. Not all slider styles show the label, but even in those cases, SwiftUI uses the label for accessibility. For example, VoiceOver uses the label to identify the purpose of the slider.
Discussion
議論
The value
of the created instance is equal to the position of the given value within bounds
, mapped into 0...1
.
The slider calls onEditingChanged
when editing begins and ends. For example, on iOS, editing begins when the user starts to drag the thumb along the slider’s track.