Created
September 26, 2023 02:24
-
-
Save byaruhaf/f9e0ea605df8381e4997db15f28ff822 to your computer and use it in GitHub Desktop.
This file contains 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
import SwiftUI | |
struct FullScreenView: View { | |
@Environment(\.dismiss) var dismiss | |
@State private var name = "Taylor" | |
var body: some View { | |
ZStack { | |
Color.primary.edgesIgnoringSafeArea(.all) | |
VStack { | |
TextField("Enter your name", text: $name) | |
.textFieldStyle(.roundedBorder) | |
.toolbar { | |
ToolbarItemGroup(placement: .keyboard) { | |
Button("Click me!") { | |
print("Clicked") | |
} | |
} | |
} | |
Button("Dismiss Modal") { | |
dismiss() | |
} | |
} | |
} | |
} | |
} | |
struct ContentView: View { | |
@State private var isPresented = false | |
var body: some View { | |
Button("Present!") { | |
isPresented.toggle() | |
} | |
.fullScreenCover(isPresented: $isPresented, content: FullScreenView.init) | |
} | |
} | |
#Preview { | |
ContentView() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment