Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacobsapps/573cd5ffc7c9b7ce9d931427758cb14f to your computer and use it in GitHub Desktop.
Save jacobsapps/573cd5ffc7c9b7ce9d931427758cb14f to your computer and use it in GitHub Desktop.
Advanced SwiftUI Interactions 1
struct ContentView: View {
@State private var showButton: Bool = false
var body: some View {
ZStack {
Color.green
if showButton {
Button("Skip Onboarding") {
// skip ahead
}
.font(.headline)
.foregroundStyle(.white)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.edgesIgnoringSafeArea(.all)
.contentShape(Rectangle())
.onTapGesture {
showButton = true
Task {
try? await Task.sleep(for: .seconds(2))
showButton = false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment