I have a couple of images with the url:
NSURL(string: "http://yxyxyxyx.com/images/events/flyer/xyxyxyxyx.png")
What's the best way to create an array with all images placed in /flyer/ using swift?
Help is very appreciated
I have a couple of images with the url:
NSURL(string: "http://yxyxyxyx.com/images/events/flyer/xyxyxyxyx.png")
What's the best way to create an array with all images placed in /flyer/ using swift?
Help is very appreciated
A relatively basic way would be to get an array of image urls within flyer/. Then you can iterate over that array and fill another one with the results of UIImage(data: NSData(contentsOfURL: url))
. However this is only recommended if there are very few images, and they are low resolution. If the images are too big run a significant risk of having iOS kill your app for using too much memory. It may be better to use something like Haneke Cache: https://github.com/Haneke/Haneke. If you cache the images one at a time, as you download them, you can keep your memory use reasonably low.
Let me know if you have any questions!