Present view as sheet and fullscreen(SwiftUI)
Dec 22, 2021
In this small article we will see how to present a SwiftUI view as sheet and fullscreen.
Create one bool variable:
@State var show = false
To present view as fullscreen :
Button(action: {print(“Forgot tapped!”)self.show = true}) {Text(“Forgot Password?”).foregroundColor(Color(UIColor.PrimaryColor.MainColor)).fullScreenCover(isPresented: $show, content: {Home()})}
To present view as sheet :
Button(action: {print(“Forgot tapped!”)self.show = true}) {Text(“Forgot Password?”).foregroundColor(Color(UIColor.PrimaryColor.MainColor)).sheet(isPresented: $show, content: {Home()})}
Hope you enjoyed reading this post!!
If you have any comment, question, or recommendation, feel free to post them in the comment section below!
Thank you!!! Happy coding.