title: In SwiftUI how can I add scroll to refresh functionality to List?
body: <p>If I have a SwiftUI List that gets its values from my server via API call, such as:</p>
  
  <pre><code>var body: some View {
      List {
          ForEach(viewModel.items) { item in
              ListItemsView(item: item)
          }
      }
      .onAppear {
          self.viewModel.getAllItems()
      }       
  }
  </code></pre>
  
  <p>The array of items is stored in the @Published var <code>items</code>, in viewModel</p>
  
  <p>The func <code>.getAllItems()</code> calls a server API which returns an array of items and stores them under the @Published var <code>items</code></p>
  
  <p>How can I add the functionality to swipe down on this <code>List</code> and call <code>.getAllItems()</code> again, in order to update <code>items</code> with new values, and theoretically re-render the <code>List</code>?</p>
  
  <p>Or is there a much better way to do this that I'm not seeing? </p>