0

Is there anyway to change the .navigationTitle color? I tried .foregroundColor and even passing the Text as a view but that did not work.

 var body: some View {
        VStack(alignment: .leading) {
           
            
            Divider()
            Spacer()
                .navigationTitle(myList.name)
            
        }.padding()
    }

I also tried using the UINavigationBar appearance:

UINavigationBar.appearance().largeTitleTextAttributes =  [NSAttributedString.Key.foregroundColor: UIColor.red]
Mary Doe
  • 1,073
  • 1
  • 6
  • 22
  • 1
    It is important at which moment it is applied - it should be *before* creating `NavigationView`. Next should be helpful https://stackoverflow.com/a/69263541/12299030 or https://stackoverflow.com/a/64304302/12299030. – Asperi Feb 06 '22 at 16:57
  • Does this answer your question? [Dynamically change and update color of Navigation Bar in SwiftUI](https://stackoverflow.com/questions/69262266/dynamically-change-and-update-color-of-navigation-bar-in-swiftui) – Yrb Feb 06 '22 at 16:58
  • @Asperi So basically, I have a List view and depending on the item I clicked from the list, a different color text will be applied to the detail view .navigationTitle. – Mary Doe Feb 06 '22 at 17:00
  • The easiest solution I can think of is simply ignore the navigation bar and recreate it myself by using the Text view. – Mary Doe Feb 06 '22 at 17:06

0 Answers0