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?
Just type
#colorLiteral(
for color or #imageLiteral(
for image and it will appear immediatly
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)
.
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.
#colorLiteral does not work in certain situations.
such as: bmi = BMI(value: bmiValue, advice: "Eat more pies", color: #colorLiteral() line above doesn't work.
Just type #colorLiteral(
and then automatically that color swatch is generating. Here you have a clear example:
My Xcode Version:
My Swift version:
© 2022 - 2025 — McMap. All rights reserved.
Color Literal
is not showing up for me either after I updated to Xcode 13. Now I have to doUIColor(named: "name of my color set")
to use my customized color. – Ostrom