Zaheer Moola
Zaheer Moola

Reputation: 133

UINavigation bar appearance tint does not work in iOS 16

I am using SwiftUI and currently setting the tint color of my navigation bar back button globally using:

UINavigationBar.appearance().tintColor = .black

After upgrading to Xcode 14 and building for an iOS 16 simulator, I have noticed that the tint that I set is now being ignored and defaulting to the system blue tint color.

I have discovered that using this approach does get it to look as expected:

let image = UIImage(systemName: "chevron.backward")?.withTintColor(.black, renderingMode: .alwaysOriginal)
appearance.setBackIndicatorImage(image, transitionMaskImage: image)

However, I am curious if there are any more elegant ways of restoring the ability to control the tint globally in iOS 16

Upvotes: 7

Views: 2975

Answers (1)

Ron Reuter
Ron Reuter

Reputation: 1347

For SwiftUI in iOS 16, to globally set the tint color of the navigation bar back button, configure the AccentColor in Assets.xcassets. Configure AccentColor in Xcode 14

Upvotes: 9

Related Questions