title: How to remove bottom/top item padding from SwiftUI List in Mac OS
body: <p>I am having a hard time removing all padding from my cells in MacOS using SwiftUI. I can't seem to be able to do it even in Apple's Code!</p>
  <p><a href="https://developer.apple.com/tutorials/swiftui/creating-a-macos-app" rel="nofollow noreferrer">https://developer.apple.com/tutorials/swiftui/creating-a-macos-app</a></p>
  <p>For example, inside the <code>LandMarkList</code> of the <code>MacLandmarks</code> folder in Xcode, I have put a <code>.listRowInsets(EdgeInsets())</code> at the end of the <code>forEach</code> so that the code looks like this:</p>
  <pre><code>struct LandmarkList: View {
      @EnvironmentObject private var userData: UserData
      @Binding var selectedLandmark: Landmark?
      @Binding var filter: FilterType
  
      var body: some View {
          List(selection: $selectedLandmark) {
              ForEach(userData.landmarks) { landmark in
                  if (!self.userData.showFavoritesOnly || landmark.isFavorite)
                      &amp;&amp; (self.filter == .all
                          || self.filter.category == landmark.category
                          || (self.filter.category == .featured &amp;&amp; landmark.isFeatured)) {
                      LandmarkRow(landmark: landmark).tag(landmark)
                          .background(Color.red)
                  }
              }
              .listRowInsets(EdgeInsets())
          }
      }
  }
  </code></pre>
  <p>I have also put a red background color in each cell. This is the result I am getting:</p>
  <p><a href="https://i.stack.imgur.com/ZFse8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZFse8.png" alt="Spaces top and bottom" /></a></p>
  <p>The point is that I just can't seem to get rid of the vertical space between the cells of this list. All solutions I have seen seem to mention iOS for this, but I want to do this in Mac OS (which should have the same behavior, but it doesn't).</p>