-
-
Save SergLam/a6b8e985c52e6e9ed3c1ee33ca34c2f0 to your computer and use it in GitHub Desktop.
SwiftUI: Discardable Slider View
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 | |
| struct DiscardableSliderView: View { | |
| @State private var value = 5.0 | |
| @State private var filterValue: Double = 5.0 | |
| var body: some View { | |
| VStack { | |
| Text("Values to filter") | |
| DiscardableSlider(value: $filterValue, bounds: 0...10, step: 1) | |
| Text("Initial value: \(Text(value, format: .number.rounded(rule: .up)).bold())") | |
| } | |
| .onChange(of: filterValue) { | |
| print(filterValue) | |
| } | |
| .padding(32) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment