Image Literal

Hi,

I'm new to iOS mobile software dev (swift) and I'm trying to use the image literal function. I'm following a tutorial and the image literal function auto-populated on the tutorial but not on my x code. The tutorial is a few years old so maybe this function was removed since updates?

When I type imageview.image = ImageLiteral the image literal function does not auto detect and I have nothing to select in order to grasp my photo from. Any help would be appreciated.

Screen shot of what I am trying to convey is below.

Answered by Sbz586 in 691468022

Update: I found that if you type "#imageLiteral(" I get the result that I'm looking for.

Thanks guys.

I'm following a tutorial and the image literal function auto-populated on the tutorial

Image literal is not a thing you type manually. If your tutorial has any parts typing ImageLiteral into a code editor, you should better not rely on the description.


Image literals are intended to be automatically generated by Xcode.

After you have successfully added an image resource to your project, you can drag the image from the Project navigator to an actual position in the code editor:

The detailed behavior may be different in versions of Xcode. Your question is about how to use Xcode and you should better include the version info in your original post. And better use the tag Xcode.

Note that if you have a space before the = sign, you must have one after.

Accepted Answer

Update: I found that if you type "#imageLiteral(" I get the result that I'm looking for.

Thanks guys.

Image Literal
 
 
Q