0
.navigationTitle(Text("Hello").foregroundColor(.orange))
.navigationBarTitleDisplayMode(.inline)

How do I add a foreground color to a Navigation Bar Title in SwiftUI? This is a watchOS app and everything I tried doesn't work.

David M
  • 51
  • 4

2 Answers2

0

I found that this solution worked:

.navigationTitle{
            Text("Hello")
                .foregroundColor(.orange)
 }
David M
  • 51
  • 4
  • Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Jeremy Caney Nov 09 '22 at 00:38
-1

I have:

NavigationView {
 // my content
}
.navigationBarTitle(Text("Hello"), displayMode: .inline)
.foregroundColor(.orange)
Trey6
  • 67
  • 2
  • 8
  • navigationBarTitle is unavailable in watchOS. Tried putting .navigationTitle(Text("Hello")) .navigationBarTitleDisplayMode(.inline) .foregroundColor(.orange) inside the NavigationView and it only changed the color of the text in the preceding VStack. I know it has to be possible somehow to change this color as I do have other watchOS apps on my phone that have colored text for the navigation bar title. – David M Nov 02 '22 at 18:29