Search code examples
iosxcodeios13xcode11

Issues with named colors on iOS 11 with Xcode 11 beta


I am trying to implement dark mode in my iOS app. I need to use named colors in order to do this, but I've run into a bit of a snag. Everything works fine on the iOS 13 simulator when switching between light and dark mode, and the colors are also correct in the iOS 12 simulator. The problem occurs when I try to run my app on an iOS 11 simulator. Any named colors that I've used in the storyboard default to the dark version of the color, and when I try to access a named color in code I get nil. Just wondering if anyone else has run into this


Solution

  • It seems that Apple know of it.

    Quote from https://developer.apple.com/ios/submit/

    Please note that apps built with Xcode 11 using named colors may experience lookup failures (with no value returned) when the app runs on iOS 11 or earlier. This will be fixed in a future Xcode update. To avoid this issue, raise the minimum deployment target to iOS 12 or later to submit to the App Store now, or rebuild with the next Xcode GM candidate seed when it’s available.

    Update 20190917

    Build your apps using Xcode 11 GM seed 2, which includes SDKs for iOS 13, iPadOS, watchOS 6, tvOS 12, and macOS Catalina. Starting April, 2020, all iOS apps submitted to the App Store will need to be built with the iOS 13 SDK or later. They must also support the all-screen design of iPhone XS Max or the 12.9-inch iPad Pro (3rd generation), or later.