ARTICLE AD BOX
I have a very weird issue that if I have a List inside a NavigationView, the title disappears. But this only happens if I have set a background color. Here is the code that Works.
import SwiftUI struct ContentView: View { var body: some View { NavigationView { ZStack { Text("World") } .navigationTitle("Hello") .toolbarBackground(Color.pink.opacity(1),for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) } } } #Preview { ContentView() }
However, as soon as I replace the ZStack with a List, it doesn't anymore:
import SwiftUI struct ContentView: View { var body: some View { NavigationView { List { Text("World") } .navigationTitle("Hello") .toolbarBackground(Color.pink.opacity(1),for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) } } } #Preview { ContentView() }
Any idea why it doesn't work and what do I need to do to get the large title to work while also retaining the ability to have a background color?
