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
| import SwiftUI | |
| import UIKit | |
| extension Color { | |
| var uiColor: UIColor { | |
| if #available(iOS 14, *) { | |
| // iOS 14 introduces an API to convert SwiftUI.Color to UIKit.UIColor | |
| // but it does not produce a color which reacts to changes in color scheme | |
| // (light mode/dark mode). To make that work we need to extract the color |
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
| final class SnappingSlider: UISlider { | |
| override var value: Float { | |
| set { super.value = newValue } | |
| get { | |
| return round(super.value * 1.0) / 1.0 | |
| } | |
| } | |
| } |