Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13 DarkMode and LaunchScreen - Fallback for iOS 10

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

like image 729
FlixMa Avatar asked Sep 23 '19 14:09

FlixMa


People also ask

How do I turn off dark mode in Info plist?

To control an interface style for an entire app, you simply set UIUserInterfaceStyle (Appearance) key in your Info. plist file. You can assign it to either Light or Dark value to force a light and dark user interface style. Set Appearance (UIUserInterfaceStyle) key to Light will disable dark mode for an entire app.

How do I add launch screen to Xcode 13?

Choose File > New > File. Under User Interface, select Launch Screen, and click Next. Give the launch screen file a name, choose a location, select the target that you want to add the file to, and click Create.

How to detect dark mode swift?

SwiftUI makes it really simply to detect when dark mode is enabled. We simply have to add a @Enviroment variable and use . colorScheme property to scan the settings on our device and see if dark mode is enabled.

How do I create a launch screen in SwiftUI?

Adding a Launch Screen In SwiftUI projects, the launch screen is not generated by default. You need to add it manually in the Info. plist file. After opening the file, you should see an entry named Launch Screen.

Is there a dark mode in iOS 13?

Dark mode in iOS 13 is not universal. It mostly applies to native iOS apps, so don’t expect to see everything render in dark mode. Also in Safari, only the user interface will show up in dark mode. However, there are a couple of hacks that you can use to make websites render in dark mode as well.

Why can't I get dark mode on my App?

You can also set Dark Mode on a schedule if you'd like. If the app is fully updated, but it still isn't gelling with iOS 13's Dark Mode, check the in-app settings. While many apps will mirror Apple's built-in Dark Mode, some might still be set to a light mode.

Does Smart Invert work with dark mode in iOS 13?

Even in Safari, Dark Mode will change the color of the toolbars, but websites need to add support for Dark Mode too, so Smart Invert can help fill that gap as well. Dark Mode (left) and Dark Mode + Smart Invert (right) in iOS 13. Keep Your Connection Secure Without a Monthly Bill.

What's new in iOS 13?

After years of rumors and disappointment, Apple finally has the dark mode everyone's been wanting, and it's one of the most significant new features in iOS 13. Dark modes have gained popularity with app developers — big names like Gboard, Google Maps, Messenger, Slack, Twitter, and YouTube already have it.


Video Answer


1 Answers

As suggested here, the solution is to use a dynamic image for the background instead:

  1. Create 2 images with the flat colors for light and dark mode.
  2. Import them in your Asset Catalog and define the “Any”/“Dark” appearances.
  3. Add a 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.

Image in Asset Catalog

Launch Screen

like image 180
Vincent Tourraine Avatar answered Oct 12 '22 02:10

Vincent Tourraine