Interactive previews iPhone

SliderTickContentForEach

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

SliderTickContentForEach - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 26.0+ iPadOS 26.0+ macOS 26.0+ watchOS 26.0+ visionOS 26.0+

Tags

SwiftUI Code

Docs
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?

Created: December 25, 2025Updated: December 26, 2025

More Slider Components

View all
Custom Slider Ticks - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Custom 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.

Slider Color - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
style

Slider Color

Customizing the color of the slider

Stepped Min Max Label Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

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 - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Slider

Creates a slider to select a value from a given range, subject to a step increment

Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Slider

Creates a slider to select a value from a given range

Explore Other Components

Browse all
List Row Insets - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

List Row Insets

Applies an inset to the rows in a list.

Link - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Link

A control for navigating to a URL

Label Icon To Title Spacing - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Label Icon To Title Spacing

Set the spacing between the icon and title in labels.

Swipe Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Swipe Action

Adds custom swipe actions to a row in a list or container, notifying you when the actions are revealed or dismissed.

Manage Subscriptions Sheet - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Manage Subscriptions Sheet

Opens the manage subscriptions sheet.

Materials - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
type

Materials

All materials

Future DatePicker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Future DatePicker

Creates an instance that selects a Date in a closed range

List Badge Prominence - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

List Badge Prominence

Specifies the prominence of badges created by this view.