A view object should not be doing networking like this. There’s nothing managing the network calls. What if you need to cancel? How do you handle errors? Worse, what if you’re using that in a UI(Table/Collection)ViewCell and the image is being set repeatedly upon dequeue? You can’t make any guarantees the UIImageView will have the intended image.
Set image1 -> download
Set image2 -> download
image2 completes first then image1.
Now you have the wrong image displayed.