iPhone SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPhone previews, Swift code, and Apple documentation. Compare every available orientation, appearance, and design.

Slider

SliderTickContentForEach

A type of slider content that creates content by iterating over a collection.

Explore SliderTickContentForEach on iPhone in portrait, with SwiftUI code and Apple API documentation.

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)
iOS 26.0+ iPadOS 26.0+ macOS 26.0+ watchOS 26.0+ visionOS 26.0+

Every available iPhone screenshot for SliderTickContentForEach.

1 views