Skip to content

Instantly share code, notes, and snippets.

@jverkoey
Last active August 1, 2024 12:49
Show Gist options
  • Save jverkoey/fd598d97feef873a4df47725df883c40 to your computer and use it in GitHub Desktop.
Save jverkoey/fd598d97feef873a4df47725df883c40 to your computer and use it in GitHub Desktop.
Google Maps directions button
import SwiftUI
struct FlipButton: View {
@State private var orientation: Int = 0
var body: some View {
Button {
orientation += 180
} label: {
Image(systemName: "arrow.up.arrow.down")
.rotationEffect(.degrees(Double(orientation)))
.animation(.bouncy(duration: 0.3), value: orientation)
}
}
}
#Preview {
FlipButton()
.padding(50)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment