To manage the memory with the image, as @russtyshelf said, you have to convert the image file to data and convert it to an image, but after that you need to make the image instance zero to clear the cache. those. in viewdidload () you should write like:
let image = [UIImage imageWithData:imageData];
and on the deinit of the controller or while switching views, your image should be zero, i.e.
image = nil
source
share