-
-
Save sturdysturge/0d5bc760c9208543928bd283d8dc0026 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
| import SwiftUI | |
| @available(iOS 16.0, *) | |
| struct ContentView: View { | |
| @State var index = 0 | |
| @State var edge = Edge.leading | |
| var body: some View { | |
| VStack { | |
| Text("Index \(index)") | |
| .id(index) | |
| .transition(.push(from: edge)) | |
| Picker("", selection: $edge) { | |
| ForEach(Edge.allCases, id: \.self) { edge in | |
| Text(edge.name) | |
| } | |
| } | |
| Stepper("") { | |
| withAnimation { | |
| index += 1 | |
| } | |
| } onDecrement: { | |
| withAnimation { | |
| index -= 1 | |
| } | |
| } | |
| } | |
| .padding() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment