我是SwiftUI的新手(就像大多数人一样),试图弄清楚如何删除我在NavigationView中嵌入的List上方的空白。
在此图像中,您可以看到列表上方有一些空白

我要完成的是

我试过使用
.navigationBarHidden(true)
Run Code Online (Sandbox Code Playgroud)
但这并没有进行任何明显的更改。
我目前正在这样设置我的navigationView
NavigationView {
FileBrowserView(jsonFromCall: URLRetrieve(URLtoFetch: applicationDelegate.apiURL))
.navigationBarHidden(true)
}
Run Code Online (Sandbox Code Playgroud)
其中FileBrowserView是具有列表和像这样定义的单元格的视图
List {
Section(header: Text("Root")){
FileCell(name: "Test", fileType: "JPG",fileDesc: "Test number 1")
FileCell(name: "Test 2", fileType: "txt",fileDesc: "Test number 2")
FileCell(name: "test3", fileType: "fasta", fileDesc: "")
}
}
Run Code Online (Sandbox Code Playgroud)
我确实要注意,这里的最终目标是您将能够单击这些单元格来更深地浏览到文件树,因此在更深层的导航上应该在栏上显示“后退”按钮,但是我不需要在我的初始视图中排名最高。