0

I am working with an app in SwiftUI.I have presented one view using

.sheet(isPresented: $doIWantThisViewToShowUser, content: {
                            DraggedUsersMenu()
                        })

DraggedUsersMenu()

is view I wanted to present. Here I have few stacks from which I need to navigate to another contentView. Now navigation Works perfectly My 2nd screen is there,but its behind this presented View. Is there a way to dismiss() this view automatically, once we navigate to another controller.?

Niharika
  • 1,188
  • 15
  • 37

1 Answers1

0

Add this: @Environment(\.presentationMode) var presentationMode.

And when you want to dismiss use: presentationMode.wrappedValue.dismiss()

Timmy
  • 4,098
  • 2
  • 14
  • 34