- July 4, 2025
- Mins Read
TvOSSlider is an implementation of UISlider for tvOS.
TvOSSlider palliates missing an implementation of UISlider for tvOS as part of UIKit.
We think that Apple might eventually include UISlider for tvOS as part of UIKit, because of that, and in order to make it easier to migrate to a possible future UIKit component, TvOSSlider has been implemented with the same public API as UISlider for iOS.
The interface only differs in a couple of new properties that were considered needed for a Big Screen implementation:
import UIKit
import TvOSSlider
class ViewController: UIViewController {
@IBOutlet private weak var slider: TvOSSlider!
@IBOutlet private weak var valueLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
slider.addTarget(self, action: #selector(sliderValueChanges), for: .valueChanged)
slider.minimumValue = 0
slider.maximumValue = 100
slider.stepValue = 10
slider.minimumTrackTintColor = .orange
}
@objc
func sliderValueChanges(slider: TvOSSlider) {
valueLabel.text = “\(slider.value)”
}
}
Podfile
:
source ‘https://github.com/CocoaPods/Specs.git’
platform :tvos, ‘11.0’
use_frameworks!
target ‘<Your Target Name>’ do
pod ‘TvOSSlider’, :git => ‘https://github.com/zattoo/TvOSSlider.git’
end
$ brew update
$ brew install carthage
github “zattoo/TvOSSlider” ~> 1.2.0