I've often read that using a CALayer
rather than a UIImageView
is an performance boost when it comes to heavy image usage. That makes sense, because UIImageView
causes 3 copies of the image in memory, which is needed for Core Animation. But in my case I don't use Core Animation.
How can I assign a UIImage
(or its image data) to a CALayer
and then display it?
ARC version requires a different cast:
or in a Swift playground (you will have to provide your own PNG image in the Playground's resource file. I'm using the example of "FrogAvatar".)