I encountered this same issue in my app. It used to work but at some point all controls became tinted the default blue instead of my custom color. I confirmed Global Accent Color Name is correct in the target's build settings and that asset catalog is added to that target.
After a bunch of debugging, I found the cause. This line of code breaks the global accent color (tested with Xcode 14 beta 5):
UINavigationBar.appearance().largeTitleTextAttributes = [.font : UIFont(descriptor: UIFontDescriptor.preferredFontDescriptor(withTextStyle: .largeTitle).withDesign(.rounded)!.withSymbolicTraits(.traitBold)!, size: 34)]
However, something like this does not break it:
UINavigationBar.appearance().largeTitleTextAttributes = [.font: UIFont.systemFont(ofSize: 34)]
Super odd. If you have any UINavigationBar
appearance overrides, try commenting them out to see if that's causing your issue.
And as a workaround, what I'm doing is setting the window's tintColor
in the SceneDelegate (manually added for my SwiftUI app):
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
(scene as? UIWindowScene)?.keyWindow?.tintColor = UIColor(named: "AccentColor")
}
}
.tint
actually overrides the AccentColor in the asset catalogue. You don't have to use it – if you set a custom AccentColor in asset catalogue everything should have it. – Zoophyte.tintColor
. Only set AccentColor in my assets catalogue to green, still have blue tint/accent in my app (device and sim). – Thracophrygian