Swift: YouTube - How to Load Images Async in UICollectionView (Ep 6)

preview_player
Показать описание
Let's take a look at how we can improve our applications to load images asynchronously while still being able to scroll a list view. This is a common issue that iOS developers run into and I'll show you how to cache images and then check to see if the request finished on the correct cell.

Completed Source Code:

Twitter Slide Out Menu Course

Podcasts Course

Intermediate Training Core Data

Instagram Firebase Course

Facebook Group

Рекомендации по теме
Комментарии
Автор

Brian I have to say thank you so much for answering the community's request. You explained everything clearly and precisely, and I believe everyone here can appreciate your hard work.

joshivanilla
Автор

Almost two years later and this little trick still keeps getting me out of trouble. I'll take it up a notch and mingle it with prefetch new delegates, thanks man 👍🏽

mchirino
Автор

This helped me a lot! Just remember that if you created the image in storyboard you'll need to need to update the custom class there!

mattcoelho
Автор

Old video but still very useful... I had been banging my head for months thinking why I am still seeing duplicate images even after dequeuing the cells and setting the image to nil

roshanthapa
Автор

All these videos that you have made, are making and will make in future have helped all of us so much.
I would really like to thank you for everything you've done for us. :)
We will always support you.

abishdangol
Автор

Brian thank you for all your series you're doing a great job... new developers like myself appreciate what you're doing, and how you explain things step by step and also running the project everytime a new feature is added!!!

ShenderRamos
Автор

I love watching videos that actually work! Plus the comment by Chiman Song with the updated Swift 4 version.

BradCaldwellAuburn
Автор

As a rather new Swift developer I am building a complex application (why start small right?) and this particular video was extremely helpful in showing me why I was having such problems with my collection view loading async data from Firebase storage. Thank you!

mymusicfun
Автор

Very useful tutorial, Brian! Can't wait next video about implementing slide screens functionality.

andreychirkov
Автор

I'v been wondering on how to solve this problem from a long time. Great tutorial! Thank you very much for the series!

Abhisweat
Автор

Sir Your are so awesome I am watching your courses from last 1 month and able to learn a lot and successfully  completed the loading from FIRBASE, Although I am .Net Architect got 12 years expereince in >net technologies but i choose swift for my app not the cross platform xamarin Its just a change of syntax but still it needs efforts

rqadri
Автор

Wow, thank you so much fur the solution. I had this issue in my Apps for years.

TMB_Randy
Автор

Thank you so much, keep it up we love your videos

Gooal
Автор

Oh wow, that's a surprise ... i am using SDWebImage to cache but the images are still blinking. I'm happy to learn the little trick you teach works the same LOL.

However, even though we're using Cache, there's still delay, esp in slower internet connection. For "smooth" user experience, usually, I am forced to use things like UIActivityIndicator to show that the app is still loading the image.
Hope to hear your opinion in this programmatically or may be a better way ... :)

VinaMelody
Автор

Or Could you make a video showing the most efficient way to implement pull to refresh in tableview? fetching data from JSON API. That would be really nice

ricardobrito
Автор

Thank you so much for these great series.These are very useful stuffs.
Please don't stop posting videos like this.

Winso
Автор

Hey Brian, I got a question really break my brain. Is the cached image will be cleared when I close the app, Is that the default behavior of cache? Or say the app will re-download the image from server each time it is relaunched. The cached image is only used when the app is alive.

ZhouHaibo
Автор

I hope you're doing well Bryan.

I'm having a bit of trouble grasping the part where you check to see if self.imageUrlString == urlString. Is there a chance that the program may change the value of urlString in the middle of dispatch_async? Could the loadImageUrlUsingString( ) be called again for a new image while the dispatch_async is doing its function for the previous image?

I truly appreciate the replies, thanks!

ladedadedaschlobonmeknob
Автор

First of all your videos are great...thank you for sharing your experience. Second, I have a question which I have been struggling with a lot. The view object should not contain any data getting or fetching logic according to MVC. It should only deal with presenting the views on screen. You are fetching data in UIImageView subclass. Isn't it against the rules of MVC. And what is the correct way of encapsulating the networking logic? ....Thank you.

woodcock
Автор

I still feel inspiration looking at you to be a Mobile app developer forever .... :)

RamYT