Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Unable to find Slider/UISlider neutralValue

An WWDC 25 a neutral value was demonstrated that allows the Slider to be 'coloured in' from the point of the neutral value to the current thumb position. Trying to use this in Dev release 1 I get errors saying no such modifier.

Was this functionality released in Dev Release 1 or am I using it incorrectly?

UISlider now has a trackConfiguration property of type UISlider.TrackConfiguration which in turn has a neutralValue property. I can't speak to a SwiftUI Slider.

I tried rolling a UISliderView with UIViewRepresntable but setting neutralValue had no effect on the slider's behaviour.

`

func makeUIView(context: Context) -> UISlider {

let configuration = UISlider.TrackConfiguration(neutralValue: 0.0, ticks: [])
let slider = UISlider()
slider.trackConfiguration = configuration

slider.minimumValue = -10.0
slider.maximumValue = 10.0
slider.value = value
slider.addTarget(context.coordinator, action: #selector(Coordinator.valueChanged(_:)), for: .valueChanged)
slider.addTarget(context.coordinator, action: #selector(Coordinator.editingDidBegin(_:)), for: .editingDidBegin)
slider.addTarget(context.coordinator, action: #selector(Coordinator.editingDidEnd(_:)), for: .editingDidEnd)
return slider

}

Lots of bugs with UISlider.TrackConfiguration.

neutralValue only works if the slider's min value is 0.0 and the max value is 1.0 and the slider's value is between 0 and 1. And of course neutralValue is also in the range 0...1.

allowsTickValuesOnly is not honored if ticks are set. Even when set to false it acts as if it is true.

enabledRange only respects the upper range, not the lower range.

Time to file a bug report.

P.S. You can work around the neutralValue issue by converting the slider's value of 0...1 with let desiredValue = slider.value * 20 - 10. That will give you a result in the range -10...10.

Unable to find Slider/UISlider neutralValue
 
 
Q