I have an iOS SwiftUI app with an Accent color set to a red/orange color.
I wanted to integrate GADMobileAds (Google Ad Mob/Mobile Ads) to my app, but when I initialize the SDK with this line, my app Accent color is gone:
GADMobileAds.sharedInstance().start { _ in
// Some logic here
}
You can see on images that the wheel settings icon + background gradients that are using the red/orange accent color are using the default blue iOS color when enabling GADMobileAds.
The only change between the two picture is the previously mentioned block of code that was commented in/out.
Any idea why GADMobileAds is removing my Accent color, and how I can have it back?
I found (thanks to Adrian comment) that adding this at the root view of the app fixes the problem:
RootView()
// `.accent` because my color is named `AccentColor` in the asset catalog
// Do not use `.accentColor(.accentColor)`, it will not work
.accentColor(.accent)
EDIT: Don't forget to also add it on every .sheet()
or .fullScreenCover()
(as it is not applied by default)
But it's really weird that AdMob changes the accent color set by Xcode automatically.