title: In SwiftUI, sorted(by: ) operation triggered from a sheet view, need to show a ProgressView while operation completes
body: <p>From Results View:</p>
  <pre><code>struct ResultsView: View {
  @State private var selectedSort : Int = 1
  
  func selectedSorter(selectedSort: Int, results: [Product]) -&gt; [Product] 
      switch selectedSort {
          case 1:
              return results
          case 2:
              return results.sorted(by: { (first, second) -&gt; Bool in
                          return second.price &lt; first.price
                  })
          Ect....
          default:
              print(&quot;Off&quot;)
              return results
          
          }
  }
  
  var body: some View {
          
          let results = selectedSorter(selectedSort: selectedSort, results: results) 
  </code></pre>
  <p>This operation takes time. I am calling it from a .sheet view called FilterView:</p>
  <pre><code>struct FiltersView: View {
  var progressHide : Bool = true
  @Binding var selectedSort:Int
  
  ProgressView(&quot;Sorting...please wait&quot;).isHidden(progressHide)
  
  Picker(&quot;Sort by&quot;, selection: $selectedSort) {
                      Text(&quot;Off&quot;).tag(1)
                      Text(&quot;Price High to Low&quot;).tag(2)
                      Ect...
                  }.pickerStyle(.wheel)
  
  }
  </code></pre>
  <p>So my question is, how can I toggle progressHide in the FilterView from Results View to show the ProgressView while the seletedSorter operation happens?</p>
  <p>In my case, I am sorting over 5000 results with images involved, it sometimes can take up to 30 seconds of a frozen screen, kinda hurting the UX cause the screen is frozen.</p>