Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Image Literal" commands not working in Xcode

I started studying swift language n there is a command Image Literal to add an image but it's not showing up anything. other than that if I try any other coding thing it automatically gets suggested but image literal is not working at all... I am using Xcode 13. Any leads would be really helpful.

like image 937
Nitin Yadav Avatar asked Feb 01 '26 22:02

Nitin Yadav


2 Answers

For image literals in Xcode 13 type:

#imageLiteral(

The image literal should be displayed and available for picking the image.

The same appears to work for the other literals:

#colorLiteral(
#fileLiteral(

This places the literal in code without code completion. The code completion stopped working on literals for me as well.

After picking an image, comment the line to see the file name, if needed.

like image 69
Marcy Avatar answered Feb 03 '26 16:02

Marcy


#imageLiteral(

Without the closing parenthesis, In this way you can add images in Xcode 13.

like image 45
MD MEHEDI HASAN Avatar answered Feb 03 '26 15:02

MD MEHEDI HASAN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!