Monday, August 10, 2026
HomeiOS Developmentios - SwiftUI: Easy methods to transfer Slider Worth with Thumb

ios – SwiftUI: Easy methods to transfer Slider Worth with Thumb

[ad_1]

I wish to create slider in SwiftUI with Worth label.

I’ve write beneath code.

struct SliderView: View {
    @State non-public var pace = 50.0
    var minValue: Double = 1
    var maxValue: Double = 100
    var physique: some View {
        VStack {
            Textual content("(pace,specifier: "%.f")")
                .foregroundColor(.blue)

            Slider(
                worth: $pace,
                in: minValue...maxValue,
                step: 1
            ) {
                Textual content("Pace")
            } minimumValueLabel: {
                Textual content("(minValue,specifier: "%.f")")
            } maximumValueLabel: {
                Textual content("(maxValue,specifier: "%.f")")
            }

        }.padding()
    }
}

However I wish to transfer worth label with slider thumb.

I’m not capable of finding any property to set .body for Y worth.

Query:

Easy methods to transfer Slider Worth label with Thumb and transfer label worth with Thumb change.

enter image description here

enter image description here

enter image description here

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments