- iOS 18.0+ (Liquid Glass on iOS 26.0+)
- Xcode 26+
- Swift 6.0+
Swift only — the framework no longer ships an Objective-C umbrella header.
Slider is distributed through the Swift Package Manager only.
Add it to the dependencies value of your Package.swift, or to the package list in Xcode
(File ▸ Add Package Dependencies…).
dependencies: [
.package(url: "https://github.com/Ramiz69/Slider.git", .upToNextMajor(from: "0.3.0"))
]Normally you'll want to depend on the Slider target:
.product(name: "Slider", package: "Slider")let slider = Slider(direction: .leftToRight)
slider.minimum = 0
slider.maximum = 1500
slider.value = 500
slider.step = 10
slider.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(slider)
slider.addTarget(self, action: #selector(valueChanged), for: .valueChanged)Set delegate to control the text shown inside the thumb and at both ends of the track, and to
observe tracking:
extension ViewController: SliderDelegate {
func slider(_ slider: Slider, displayTextForValue value: CGFloat) -> String {
"\(Int(value)) ₽"
}
}Tapping the track moves the thumb only when you opt in:
slider.allowsTapToSeek = trueOn iOS 26 and later the thumb is rendered with UIGlassEffect inside a
UIGlassContainerEffect, so it refracts the track and merges with it near the ends. Older
systems keep the flat appearance, and the same code runs on both:
slider.glassConfiguration = GlassConfiguration(
style: .regular, // or .clear
isInteractive: true, // the material reacts while dragging
appliesToTrack: false // opt the track background into the material too
)Opt out entirely with GlassConfiguration(mode: .disabled). The thumb label color is picked for
contrast against the material; override it with ThumbConfiguration(textColor:).
// Resumes once the animation has finished.
await slider.setValue(750, animated: true)
// Observe every change as an asynchronous sequence.
for await value in slider.valueStream {
print(value)
}
// Warm up the haptic engine so the first touch is not delayed.
await slider.prepareHaptics()The slider is an adjustable accessibility element: VoiceOver reads its value through the
delegate's display text, and swiping up or down moves it by one step (or by 1% of the range
when step is zero).
Horizontal directions follow the interface layout direction: in a right-to-left locale
leftToRight is rendered right to left, the way UISlider behaves. Vertical directions are
never mirrored. Read resolvedDirection for the direction actually used, and opt out to pin the
slider to the direction you assigned:
slider.respectsLayoutDirection = falseramiz69, ramiz161@icloud.com
Slider is available under the MIT license. See LICENSE for details.




