Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SwiftUI button implementation with image that is changed on press, without default highlighting
Image(!isPressed ? "imageNormal" : "imagePressed")
GeometryReader { geometry in
Button(action: { }, label: {
.frame(width: geometry.size.width, height: geometry.size.height)
.pressAction {
isPressed = true
} onRelease: {
isPressed = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment