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?
@Stevie, try typing in a empty line #colorLiteral, upon typing ( the square icon for literal will show up.
When you type Color Literal , a white bo x appears. In order to set the required colour, tap on that white box to select the colour from Color Picker . Show activity on this post. Type #colorLiteral() and #imageLiteral() to see a color picker or image picker respectively.
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)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With