I have a blue logo on the launchscreen.storyboard on white background. For the new DarkMode introduced with iOS 13 I like to invert the colors, i.e. blue background and white logo.
As we know this can be done using named colors from the asset catalogues, which change depending on the traits of the device. This is working totally fine in iOS 11 and up but shows this error when trying to support iOS 10:
Named colors do not work prior to iOS 11.0.
I tried making a view controller for the launchscreen scene in code and set the colors there using the #ifavailable
clause, but the compiler says a launchscreen may not have a custom class associated with it.
I also thought of using different launchscreen storyboards depending on the iOS version but I couldn't find anything about how to.
Anything I can do about it? How to solve this problem?
Thanks, Felix
As suggested here, the solution is to use a dynamic image for the background instead:
UIImageView
in the background of your Launch Screen with this image (“Scale to Fill”, constrained to container).This will compile even if your deployment target is lower than iOS 11.0, and will display the appropriate color at launch.