Created
August 12, 2021 17:42
-
-
Save IsaAliev/8333185637759e02f1d3f01c669b3250 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
struct AccountView: View { | |
@State var showsModal: Bool = false | |
// 1 - Add EnvironmentObject variable to set your modal view | |
@EnvironmentObject var fullScreenModal: FullScreenModalProvider | |
var body: some View { | |
ZStack { | |
Button("Show modal") { | |
withAnimation { | |
// 2 - Set your modal view to content property | |
fullScreenModal.content = AnyView( | |
ModalView { | |
// 3 - Set content property to nil ti dismiss | |
fullScreenModal.content = nil | |
} | |
) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment