3

I am trying to support dark mode in a splash screen, which means that I am using a named color inside the LaunschScreen.storyboard file, but I have this error:

Named colors do not work prior to iOS 11.0.

Clearly the problem is that named colors work only in the newer versions of iOS, but there is no easy fix for that. I tried to create a custom view and set the color there, but I just found out that it's not allowed to use custom classes in launch screens. For now the only solution that comes to my mind is to create two separate targets, one for iOS 11+, one for the lower versions but it's a bit overkill and I don't like the idea. Apparently there is no recommendation from Apple on how to support dark mode in launch screen (or at least I couldn't find anything). Any suggestion?

Nald Dev
  • 557
  • 5
  • 15
Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187

2 Answers2

0

Use systemBackgroundColor for the main view background color.

You can change in Storyboard GUI (no code needed) automatically the system will set the right color in iOS13 and white for previous iOS versions.

PS: for other colors you can use System xxxx Color for standards.

Fabiosoft
  • 1,141
  • 14
  • 32
0

As you said named colors will not work below iOS 11.

[alternative] So, you can create an Image View in Launch screen and set a dark appearance for that image like below. You can apply your colors in that image.

enter image description here

Manikandan
  • 1,195
  • 8
  • 26