What: add space between the list inside a Navigation Stack and the toolbar on top.
Current code is like this
struct ContentView: View {
let words = ["Hello", "World", "SwiftUI", "OpenAI", "ChatGPT"]
var body: some View {
NavigationStack {
List(words, id: \.self) { word in
NavigationLink(destination: AnotherView()) {
Text(word)
}
}
.padding(.top, 50)
.listStyle(.insetGrouped)
.listRowInsets(EdgeInsets())
.navigationTitle("Words")
.toolbarBackground(.yellow, for: .navigationBar)
.toolbarBackground(.visible, for: .navigationBar)
.toolbar {
Text("something")
}
}
}
}
It creates space in this white background.
How I can have space but match the background color the same as what the screen has.

So putting a
Vstackin yourNavigationStacktry something like below is working for me. But there is an issue with it too,When you pull down your list yellow color of toolbar stretch till bottom. But using above code it will loose that functionality. Not sure how much helpful it is, But you can try using this, if that is helpful. Attaching a screenshot for your ref. Tried on Xcode 14.3. I hope it helps.