Xcode 9.2 stops compiling for target <11.0 when using named colors

I know that named colors are supported from 11.0, but our project targets iOS 9.0, and we were able to compile it using Xcode 9.0 / 9.1, because named colors were used only in the storyboard, and not at run time.

After switching to Xcode 9.2, the project does not compile:

named colors do not work until iOS 11.0

It seems that the problem is new, I did not find that anyone has the same problem.

+4
source share
1 answer

, , iOS 11, , iOS 11 check, .

if #available(iOS 11.0, *) {
   view.backgroundColor = UIColor(named:"CustomColor")
} else {
   // Fallback on earlier versions
   view.backgroundColor = .white
}
0

Source: https://habr.com/ru/post/1690897/


All Articles