MacOS 上的 SwiftUI NavigationView 在列表上方留下填充

SwiftUI NavigationView on MacOS leaves padding above List

我有一个 NavigationView,它在 NavigationLink 的列表上方留下了看起来像填充的东西,我不知道如何摆脱它?

这是调用 NavigationView 的视图:

struct SearchView: View {
    @EnvironmentObject var networkManager:NetworkManager
    
    var body: some View {
        VStack {
            SearchBar()//<- This view houses the content above the list but contains no padding after the divider and when the filesToDisplay is false it shrinks to the divider as expected
            if networkManager.filesToDisplay {
                ResultsView()
            }
        }
    }
}

这是 NavigationView:

struct ResultsView: View {
    @EnvironmentObject var networkManager:NetworkManager
    var body: some View {
        NavigationView {
            List {
                ForEach(networkManager.FileList!.items) { file in
                    NavigationLink(destination: FileDetail(fileDetail: file)) {
                        FileRow(fileRow: file)
                    }
                }
            }
            Rectangle().frame(maxWidth: 0, maxHeight: .infinity)
            }.frame(minHeight:500, idealHeight: 550, maxHeight: .infinity)
    }
}

我认为问题可能与 navigationBarTitle 有关,但 MacOS 似乎不使用它?我尝试了各种不同的填充和 listRowInsets,但没有任何效果。

添加显式间距

VStack(spacing: 0) {   // << here !!
    SearchBar()
    if networkManager.filesToDisplay {
        ResultsView()
    }
}