Created
April 8, 2025 16:33
-
-
Save jacobsapps/573cd5ffc7c9b7ce9d931427758cb14f to your computer and use it in GitHub Desktop.
Advanced SwiftUI Interactions 1
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
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