I am trying to use the new destination of the #imageLiteral embedded image from the folder with your resources in Xcode 8, where instead of the syntax of all UIImage(named: "") , only the image is displayed, as shown here .
But when I do this, I get the error "Expected expression as a result of return" when it is a function.
Here is a simple example:
func img() -> UIImage { return #imageLiteral(resourceName: "small-checkmark") }
Where Xcode displays a small-checkmark , as you would expect, but it will not compile due to the above error. For me, everything is autocomplete, the file is located in the resource folder (in PDF format). I do not understand what's going on. If I just return it to UIImage() , it compiles fine.
What should I do?
source share