Created
November 10, 2025 13:24
-
-
Save lanserxt/735c5c3d02c95a20d9fb26e9afaa1194 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) | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And Liquid Glass version