Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 29, 2021 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iosdevie/4556781df7386166568c962ac5220825 to your computer and use it in GitHub Desktop.
Save iosdevie/4556781df7386166568c962ac5220825 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State private var didLongPress: Bool = false
var body: some View {
Rectangle()
.foregroundColor(Color.purple)
.cornerRadius(40)
.scaleEffect(didLongPress ? 1.2 : 1)
.frame(width: 200, height: 200, alignment: .center)
.gesture(LongPressGesture(minimumDuration: 1.0)
.onEnded({_ in self.didLongPress.toggle() }))
.animation(.easeInOut)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment