title: Is there a way to dismiss a modal view without animation in SwiftUI?
body: <h2>Is there a way to dismiss a modal view without animation in SwiftUI?</h2>
  
  <p>I want to dismiss a modal without the dismiss animation because I want to navigate from the modal view to a new SwiftUI View using a view router. Everything is working, except for the transition animation from the modal view to the new full-screen view. I followed that tutorial to create a view router: <a href="https://blckbirds.com/post/how-to-navnigate-between-views-in-swiftui-by-using-an-environmentobject/)" rel="noreferrer">Tutorial</a></p>
  
  <p>I'm using that code snippet to present the modal view:</p>
  
  <pre><code>struct ContentView: View {
  
    @State private var showModal = false
    @Environment(\.presentationMode) var presentationMode
  
  
    var body: some View {
      Button(action: {
          self.showModal = true
      }) {
          Text("Show modal")
      }.sheet(isPresented: self.$showModal) {
          ModalView()
      }
    }
  }
  
  
  struct ModalView: View {
  
    @EnvironmentObject var viewRouter: ViewRouter
  
    var body: some View {
      Group {
        Text("Modal view")
        Button(action: {
           self.viewRouter.currentPage = "New View"
        }) {
          Text("Dismiss")
        }
      }
    }
  }
  </code></pre>
  
  <p>Source: <a href="https://stackoverflow.com/a/56563652/8642838">Answer by @M Reza Farahani</a></p>
  
  <p>Here is a solution in Swift: <a href="https://stackoverflow.com/questions/44079529/close-modal-without-animation">Swift solution</a></p>