I am using the Xcode 13 beta and noticed the Color Literal
suggestion when trying to choose a color with a picker does not show up (in previous versions I would do Color(Color Literal())
and a color picker would show up. Any thoughts on this?

- 209
- 1
- 3
- 5
-
3`Color Literal` is not showing up for me either after I updated to Xcode 13. Now I have to do `UIColor(named: "name of my color set")` to use my customized color. – EmilyWatts Sep 22 '21 at 00:18
-
https://stackoverflow.com/a/70151322/9136962 – Suresh Mopidevi Nov 29 '21 at 07:59
4 Answers
Just type
#colorLiteral(
for color or #imageLiteral(
for image and it will appear immediatly

- 171
- 1
- 4
-
This worked for me with the #colorLiteral( in Xcode 13. I hope they fix the problem! Thank you! – David_2877 Dec 02 '21 at 18:17
-
not working, it's just showed "Missing arguments for parameters 'red', 'green', 'blue', 'alpha' in call" :/ – Stevie Mar 21 '22 at 05:29
-
2@Stevie, try typing in a empty line #colorLiteral, upon typing ( the square icon for literal will show up. – arvinq May 16 '22 at 04:55
-
-
1It works **on an empty line** (Xcode 14), but that defeats the purpose when you want to add the color as a parameter. – Mahm00d Apr 09 '23 at 06:44
Edit (September 26, 2021): As of Xcode 13.0 (13A233), color literals seem to be working now.
It's a known issue. From the release notes:
#colorLiteral, #imageLiteral, and #fileLiteral aren’t rendered. (75248191)
But other than that, note that init(_ color: UIColor)
is deprecated, so you can't do something like Color(UIColor.blue)
. This applies to color literals too.
Instead, use the new init(uiColor: UIColor)
.

- 24,434
- 8
- 68
- 125
Solved like this in Xcode 13.4: Put a SPACE after "=" when assigning. Yes, it's that ridiculous. Then double click to pick a color. So:
var someColor = #colorLiteral(
After that can select a color.

- 133
- 6
-
This was exactly what I was looking for, found this answer straight away. I gave up on the colour literal for a long time, but remembered how much easier it was when it was there to use. I wish Apple would have never changed it from colorLiteral, which would autocomplete, to your answer of #colorLiteral( which does not autocomplete. I just have to remember that #colorLiteral( now. Thanks – daj mi spokój Nov 17 '22 at 04:48
Just type #colorLiteral(
and then automatically that color swatch is generating. Here you have a clear example:
My Xcode Version:
My Swift version:

- 563
- 7
- 15