Learn Courses My Dashboard

Color Literal not working in Xcode 14

Hi, I am trying to use color literal and it seems that is not working in Xcode 14.

Can anyone help me?

Br,
Bruno

If you are trying to use it in SwiftUI you will run into all sorts of issue since it is a UIColor as opposed to a Color.

To get a color literal to work you have to type:
#colorLiteral()

In SwiftUI you can do this:

Screen Shot 2023-01-19 at 09.09.13

and then use that in a View like this:

Color(myColor)

1 Like