• Ask a Question
  • Create a Poll
150
    Ask a Question
    Cancel
    150
    More answer You can create 5 answer(s).
      Ask a Poll
      Cancel

      How to manually go back to folders View on document-based SwiftUI iOS apps

      I have the simplest document-based SwiftUI iOS app, directly from the xcode template. When the app is open, it shows by default the folders view with the ability to either open a file or create a new one. When you open/create a file, it opens a new View with a navigation bar that enables to close the current file and go back to the folders view.

      I hid the navigation bar with a .navigationBarHidden(true) and I want to add a custom button to be able to go back to the folders view.

      I tried the usual:

      @Environment(\.presentationMode) var mode: Binding<PresentationMode> Button(action: {   self.mode.wrappedValue.dismiss() }, label: {   Text("Back") }) 

      But it does nothing. How can I manually go back to the folder view?

      0 Answers