Skip to content

Instantly share code, notes, and snippets.

@lawreyios
Created May 13, 2020 10:16
Show Gist options
  • Save lawreyios/59b415d39c1deb12317072ac05d673ef to your computer and use it in GitHub Desktop.
Save lawreyios/59b415d39c1deb12317072ac05d673ef to your computer and use it in GitHub Desktop.
struct ModalView: View {
var body: some View {
NavigationView {
VStack {
Spacer()
Text("ModalView")
Spacer()
}.modifier(RedNavigationBar(title: "Modal"))
}
}
}
struct ContentView: View {
@State var presentedModal = false
var body: some View {
NavigationView {
VStack {
Spacer()
Spacer()
Text("ContentView")
Spacer()
Button(action: {
self.presentedModal = true
}) {
Text("Present Modal")
}
Spacer()
Spacer()
}
.modifier(GreenNavigationBar(title: "Content"))
.sheet(isPresented: $presentedModal) {
ModalView()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment