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.

Feedback has been filed on this. We'll see what 26b2 looks like.

I filed FB18101140 last week. Hopefully the issues will be resolved soon. Looking forward to the next beta release.

Anybody have any idea how to use the UISliderTrackConfiguration API from Objective-C? The docs are all for Swift.

Actually, I found the Obj-C docs for UISliderTrackConfiguration.

Below is some sample code. This makes it easy for users to choose one of three positions on the slider. However, I have not been able to get any of my tick mark graphics to actually appear on the slider UI (either I or the beta API must be doing something wrong).

UISliderTick *theSliderTick0 = [UISliderTick tickWithPosition:0.0 title:@"-4" image:[UIImage systemImageNamed:@"dot.crosshair"]];
UISliderTick *theSliderTick1 = [UISliderTick tickWithPosition:0.5 title:@"0" image:[UIImage systemImageNamed:@"dot.crosshair"]];
UISliderTick *theSliderTick2 = [UISliderTick tickWithPosition:1.0 title:@"4" image:[UIImage systemImageNamed:@"dot.crosshair"]];
UISliderTrackConfiguration *theConfig = [UISliderTrackConfiguration configurationWithTicks:@[theSliderTick0, theSliderTick1, theSliderTick2]];
theConfig.allowsTickValuesOnly = NO;
theConfig.minimumEnabledValue = -4.0;
theConfig.neutralValue = 0.0;
theConfig.maximumEnabledValue = 4.0;
mySlider.trackConfiguration = theConfig;
Unable to find Slider/UISlider neutralValue
 
 
Q