Reputation: 1005
I know that named colors are supported from 11.0 but our project targets iOS 9.0 and we were able to successfully compile it using Xcode 9.0 / 9.1 because named colors were used only in storyboard and not in runtime.
After switching to Xcode 9.2 the project does not compile:
named colors do not work prior to iOS 11.0
Upvotes: 6
Views: 3870
Reputation: 6023
//Please right click on Storyboard
//Alt+CMD+f
Now ctrl+F and paste .
color key=(.*) name=.*
and now replace find source with this line
<color key=$1 red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
//MARK:- OR Paste your key in key
(<color key="your key")
build and run
Upvotes: 4
Reputation: 12023
It's a newer feature so they might have stopped supporting it inside storyboard for earlier versions than iOS 11, although you can use it in code by putting iOS 11 check and it works fine.
if #available(iOS 11.0, *) {
view.backgroundColor = UIColor(named:"CustomColor")
} else {
// Fallback on earlier versions
view.backgroundColor = .white
}
Upvotes: 0