Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Mohammad A1,895 Points
blog but with 1000 posts
How can I make a blog reader app retrieve 1000 posts without letting the user wait for a long time?
I have checked the lazytableimages from apple and I can download all the posts but that comes on the expense of user time.
Amit BijlaniTreehouse Guest Teacher
Mohammad A you probably want to have some kind of paging so you don't download thousand items in one go. As for asynchronous, I have created a video explaining how you can asynchronously load data using the Blog Reader app as an example:
It uses NSURLSession and NSURLSessionDownloadTask
Kieran Robinson9,411 Points
Hi Amit Bijlani, is this possible with things not downloaded from the web? for example I have images on a tableview cell that the user inputs from their photo roll or camera. however due to the amount of images the page can be sluggish to scroll. Can i multithread the image loading so that it is quicker to scroll? Kieran
M T11,934 Points
Amit Bijlani, is there a handy place I can find the rest of your tips videos? This was great, thank you.
Thomas Nilsen14,957 Points
Maybe try to download it asynchronously, and not do it on the main thread. That way your app will still be functional while thing is finishing up in the background.
Mohammad A1,895 Points
I'm doing it all asynchronously. I have 1000 posts with images all in a tableview. First I download and parse JSON data; titles and links to images of 1000 posts (not in the main thread), and then when the user scroll down, download of images begin.
The download of JSON data is the problem. I do not know how can I divide the download process and then update the tableview smoothly.
You should use Grand Central Dispatch
Hope that helps.