I'm developing a CarPlay app and need to correctly handle style changes, particularly the distinction between Dark Mode for the UI and the map's appearance. I'm using [CPSessionConfigurationDelegate.contentStyleChanged]((_:contentstylechanged:))
and [CPTemplateApplicationSceneDelegate.contentStyleDidChange]((_:))
to track these changes, which works well in most cases.
However, I've encountered an edge case:
- Settings: Appearance -> Always Dark
- Settings: Maps -> Always Show Dark Map -> OFF
In this scenario, both contentStyleChanged
and contentStyleDidChange
report a .light
content style. This is incorrect because while the map should be displayed in light mode (due to the "Always Show Dark Map" setting), the UI should still be in dark mode due to the "Always Dark" setting in Appearance.
My goal is to replicate the behavior of Apple Maps and Google Maps, which correctly display a light map with a dark UI in this specific scenario. How can I reliably determine the intended UI style (dark in this case) independent of the map style override?
Image from Google maps as a reference:
Here's what I've tried so far:
- Using
CPSessionConfigurationDelegate.contentStyleChanged
andCPTemplateApplicationSceneDelegate.contentStyleDidChange
. These methods provide the resulting style after the map override, not the intended UI style.
Is there a way to access the underlying "Appearance" setting (Automatic/Always Dark) separately from the "Always Show Dark Map" setting? Or is there another approach to correctly differentiate between the intended UI style and the map's appearance in CarPlay?
Any help or pointers in the right direction would be greatly appreciated!