I am fairly new to Xcode and Swift, and have been displaying my images using
UIImage(named: "")
instead of contentsOfFile. Now I want to switch it to contentsOfFile to avoid image cacheing. (I have hundreds of images).
I have looked at questions such as this one: UIImage using contentsOfFile And dozens others which all recommend the following code:
var bundlePath = NSBundle.mainBundle().pathForResource("imageName", ofType: "jpg")
var image = UIImage(contentsOfFile: bundlePath!)
However this code has not been working for me. The answer in the linked question mentions creating a group and adding the images there, as well as copying it to "Copy Bundle Resources). I'm afraid I don't know what that means or how to do this. I tried bundling my resources in finder with .bundle and adding that to Xcode assets, but it did not work.
Could someone help guide me step by step on how to get contentsOfFile to work? Keep in mind I am fairly new to Xcode in your answers.
Thanks in advance! Sorry if this question is poorly written/ improperly formatted, I am also brand new to stack overflow.