Present view as sheet and fullscreen(SwiftUI)

Nitish Kumar
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()})}
Fig1: full screen

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()})}
Fig2: sheet

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.

--

--

Nitish Kumar

I developed and maintain applications aimed at a range of iOS devices including mobile phones and tablet computers.