Asynchronous code is used to make calls on the main thread. Broken code is being explored for you to fix because it is recommended to update the UI on the main thread.
- [Instructor] When you run a task asynchronously, … it will start, but will not wait … for the task to be completed. … Execution is returned to your app immediately, … and this frees up your up to do other tasks. … It's important to note … that cues are based on first in, first out basis, … but this doesn't guarantee that the first task submitted … will be the first task finished. … The FIFA order only applies to when tasks start … not when they finish. … Here's an example of asynchronous code. … Here we have created a queue … and we can submit a task to run in the background thread. … Once it's done, you can delegate the code … back to your main queue by calling DispatchQueue.main.async. … We can also execute code asynchronously after a given delay. … The task is scheduled … for a specific time, and returns immediately. … We do this by using the asyncAfter function, … which takes a deadline parameter of dispatch time, … and an execute parameter of dispatch work item. … For instance, the function takes …
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.