Join Grace Njoroge for an in-depth discussion in this video Solution: Optimizing the collection view, part of iOS Development: Threading and Grand Central Dispatch.
(upbeat music) … - [Instructor] For our solution, … open the MainViewController, … go to the CellForItemAt function. … You're going to ensure that our image is downloaded … from a background queue. … Then change our if statement to a guard statement. … Let's just copy this here. … Don't forget the else, … else we return. … Now once we have the image, … we need to update it on the main thread … or from the main thread. … So we call DispatchQueue.main.async, … and then we update the cell from there. … Okay, let's now run our code. … You will notice that the app … has started up much more faster than earlier … and also the UI is scrolling much more smoothly. … …
Skill Level Intermediate
1. Evolution of GCD
2. Working with Queues
3. Asychronous vs. Synchronous Execution
4. Concurrency vs. Parallelism
What are deadlocks?1m 21s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.