In this tutorial, I will show you an alternative way to do the same thing as Image Literal in Swift Xcode.
When I was trying to use the image pick-up option through image literal then I noticed no image literal option is coming up in Xcode.
Then, I tried to use #imageLiteral(resourceName: "Image")
The above piece of Code may work but not every time. In some of the Xcode versions after typing the first #imageLiteral(
portion, you will be seeing the image picker option.
But I suggest you not to use this as it causes trouble in most cases.
In my opinion, the option is to use the below code.
UIImage(named: "Image" )
In the above code you need to insert the image name as a string so wrap that in double-quotes.
Who.What = UIImage(named: "carImage")
Hope this line explains much easier. For me, if I wish to change the image then I should type the below piece of code. In place of who you can write the object name whose property you want to change.
Who.image = UIImage(named: "catImage")