title: How to present modal in SwiftUI automatically without button
body: <p>I am thinking of using a switch case to present different views.</p>
  <pre><code>struct searchview : View {
  
   var body: some View {
        VStack {
  
              VStack {
                       if self.speechRecognition.isPlaying == true {
                           VStack {
                               Text(self.speechRecognition.recognizedText).bold()
                              .foregroundColor(.white)
                              .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .center)
                              .font(.system(size: 50))
                              
                              .sheet(isPresented: $showSheet) {
                                  self.sheetView
                              }
                           }.onAppear {
                               DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                                   self.showSheet = true
                               }
                           }
                          }
         }.onAppear(perform: getViews)
  
   
   }
       
  var currentSheetView: String {
      var isProductDictEmpty = Global.productDict.isEmpty
      var wasTextRecognizedEmpty = self.speechRecognition.recognizedText.isEmpty
      var checkTextandDict = (wasTextRecognizedEmpty,isProductDictEmpty)
   
  
      switch checkTextandDict {
  
      case (true,true):
  
          print(&quot;Product dict and Text rec are empty&quot;)
          return &quot;error&quot;
  
      case (false,false):
          print(&quot;Yes we are in business&quot;)
          return &quot;product&quot;
  
  
      case (true,false):
          print(&quot;OOPS we didnt catch that&quot;)
          return &quot;error&quot;
          
      case (false,true):
          print(&quot;OOPS we didnt catch that&quot;)
      return &quot;zero match&quot;
      
          
      }
    }
     @ViewBuilder
     var sheetView: some View {
  
      if currentSheetView == &quot;product&quot;  {
            ProductSearchView(model: self.searchModel)
        }
      else if currentSheetView == &quot;zero match&quot; {
           zeroResult()
      }
      else if currentSheetView == &quot;error&quot; {
          SearchErrorView()
      }
      
      
    }
      
       }
  
   }
  </code></pre>
  <p>I know how to use <code>.sheet</code> modifier to present modal when a button is pressed but how could I the present the respective modals in swift cases automatically with button?</p>
  <p>UPDATE</p>
  <p>these are the views I am trying to implement</p>
  <pre><code>struct SearchErrorView: View {
     var body: some View {
        VStack {
            Text(&quot;Error!&quot;)
            Text(&quot;Oops we didn't catch that&quot;)
        }
      }
   }
  
  struct zeroResult: View {
    var body: some View {
      Text(&quot;Sorry we did not find any result for this item&quot;)
     }
  }
  </code></pre>
  <p>I'm not sure what I am doing wrongly. I tried to implement the solution below but still not able to call the views with the switch cases.</p>