SliderTickContentForEach
A type of slider content that creates content by iterating over a collection.
Platform Compatibility
Tags
SwiftUI Code
Slider(value: $percentage) {
Text("Percentage")
} currentValueLabel: {
Text("\(percentage)%")
} ticks: {
SliderTickContentForEach(
stride(from: 0.0, through: 1.0, by: 0.25).map { $0 },
id: \.self
) { value in
SliderTick(value) {
Text("value: \(value * 100)%")
}
}
}
.padding(.horizontal)Found an issue or have a suggestion?
More Slider Components
View allCustom Slider Ticks
Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels and customizable ticks.
Stepped Min Max Label Slider
Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels
Stepped Slider
Creates a slider to select a value from a given range, subject to a step increment
Explore Other Components
Browse allButton Styles
A type that applies standard interaction behavior and a custom appearance to all buttons within a view hierarchy
CircularGaugeStyle
A gauge style that displays an open ring with a marker that appears at a point along the ring to indicate the gauge’s current value
AccessoryCircularCapacityGaugeStyle
A gauge style that displays a closed ring that’s partially filled in to indicate the gauge’s current value