Is there a way to decrease or increase the slider ball size in swiftui?

For some reason .controlSize(_:) modifier is not working for me.
But I found a decent solution without using UIViewRepresentable and Third-party libraries.
Just add UIKit customisation you need inside .onAppear() modifier and that's it.
Slider(value: $currentValueProgress, in: 0...100, step: 1)
.accentColor(.white)
.onAppear {
let progressCircleConfig = UIImage.SymbolConfiguration(scale: .small)
UISlider.appearance()
.setThumbImage(UIImage(systemName: "circle.fill",
withConfiguration: progressCircleConfig), for: .normal)
}
you can also add the .controlSize(_:) modifier. The options are: .mini, .small and .regular
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With