title: How to hide empty rows in List
body: <p>I have created simple List, but I want to hide empty rows. Any help? I know how to hide them for UITableView but not for new SwiftUI List. I tried documentation, but I didn't find anything.</p>
  
  <pre><code>struct LandmarkList: View {
      @EnvironmentObject var userData: UserData
  
      var body: some View {
          NavigationView {
              List {
                  Toggle(isOn: $userData.showFavoritesOnly) {
                      Text("Favorites only")
                  }
                  ForEach(userData.landmarks) { landmark in
                      if !self.userData.showFavoritesOnly || landmark.isFavorite {
                          NavigationButton(destination: LandmarkDetail(landmark: landmark)) {
                              LandmarkRow(landmark: landmark)
                          }
                      }
                  }
              }
              .navigationBarTitle(Text("Landmarks"), displayMode: .large)
          }
      }
  }
  </code></pre>
  
  <p>Result</p>
  
  <p><a href="https://i.stack.imgur.com/9Ub6j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Ub6j.png" alt="Result"></a></p>