How to display a UIImage from an NSURL

If you’re displaying images from the main iOS bundle, things are fairly straightforward:

self.imageView.image = [UIImage imageNamed:@"Amy.png"];

But if you have an NSURL to your image then it’s not as easy. It took me some digging to find out that you have to convert the URL into NSData first, and then display the data:

NSData *imageData = [NSData dataWithContentsOfURL:destinationURL];
self.imageView.image = [UIImage imageWithData:imageData];

Convoluted – but currently the only way I know how to do it.