Created
May 3, 2021 18:16
-
-
Save mhijack/c812e9ecea7044f4a6d013f26252a75a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var progressBarHighlightedObserver: NSKeyValueObservation? | |
private lazy var progressBar: UISlider = { | |
let bar = UISlider() | |
bar.minimumTrackTintColor = .red | |
bar.maximumTrackTintColor = .white | |
bar.value = 0.0 | |
bar.isContinuous = false | |
bar.addTarget(self, action: #selector(handleSliderChange), for: .valueChanged) | |
self.progressBarHighlightedObserver = bar.observe(\UISlider.isTracking, options: [.old, .new]) { (_, change) in | |
if let newValue = change.newValue { | |
self.didChangeProgressBarDragging?(newValue, bar.value) | |
} | |
} | |
return bar | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment