You can customize the title text color and the background color of the navigation bar like the following for a workaround.
import SwiftUI
struct ContentView: View {
@Environment(\.colorScheme) var colorScheme
var body: some View {
NavigationStack {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
}
/*
.navigationBarItems(
trailing: Text("Trailing").foregroundStyle(.yellow)
)
*/
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .principal) {
Text("GGGGGGG GGGGGGG")
.font(.title)
.bold()
.foregroundColor(colorScheme == .light ? .white : .black)
}
}
.toolbarBackground(colorScheme == .light ? .black: .white, for: .navigationBar)
.toolbarBackground(.visible, for: .navigationBar)
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: