0

I can't figure out how to set the navigation title colour on my watch OS app. I've tried everything I can think of, but it's always grey.

How do I make "My App" blue in this example

    @main
    struct GiveBloodApp: App {
    
        @StateObject var appModel = AppModel()

        @SceneBuilder var body: some Scene {
            WindowGroup {
                NavigationView {
                Text("Hello World").multilineTextAlignment(.center)
                        .navigationTitle("My App")
                }
            }                      
        }
    }
rykeeboy
  • 645
  • 2
  • 8
  • 22
  • This actually is not possible with SwiftUI as far as I know and can only be achieved with UIKit. See this older post: https://stackoverflow.com/questions/58035341/navigationbartitle-color-change-for-watchos-in-swiftui – Björn Nov 25 '21 at 21:34
  • 1
    I’m pretty sure it adopts the accent color if set – lorem ipsum Nov 26 '21 at 01:17
  • That was the problem. I had to change the accent color resource. Didn't even realize it was there – rykeeboy Nov 27 '21 at 13:55
  • Does this answer your question? [NavigationBarTitle color change for watchOS in SwiftUI](https://stackoverflow.com/questions/58035341/navigationbartitle-color-change-for-watchos-in-swiftui) – CodeChimp Jan 10 '22 at 15:29

1 Answers1

0

Update your navigationTitle with the following to compose its contents and describe the colour.

.navigationTitle {
    Text("Your App").foregroundColor(.red)
}
keyle
  • 2,762
  • 3
  • 24
  • 27