Learn about some best practices in this demo. Build an app that executes lengthy operations using GCD.
- [Instructor] Note that submitting a task…synchronously through the main queue causes a deadlock.…Actually, that's true for any serial queue.…Calling sync from a task that is executing on the same queue…will deadlock the serial queue.…To understand the cause of the deadlock,…let's inspect the use case.…Say we want to execute the task…synchronously on the main queue.…I'm going to add a call to our view did load method.…So I call dispatch queue main…and execute it synchronously.…
Let's do some basic stuff.…We'll only print a lot to the console.…Let's try to run the app.…We see an error.…Now let's take a closer look.…The call stack shows that the last function called…before the crash was dispatch sync wait.…The assembly view contains a warning…which states: bug in client of libdispatch…dispatch sync called on queue…already owned by current thread.…
So this is what happens behind the scenes.…First, the sync method submits the block…to the main queue for execution.…The main queue is serial, that is,…it only executes one block at a time.…
- Unified Modeling Language (UML)
- Use case, class, and sequence diagrams
- App state preservation and restoration
- Fundamental architectural design patterns
- Model-view-controller (MVC) and model-view-presenter (MVP)
- Implementing one-way binding
- App stage changes
- Building responsive apps
- SOLID principles
- Exchanging information between apps
- Optimizing your apps to avoid excessive CPU usage
Skill Level Intermediate
What you should know1m 5s
1. UML Basics
2. The iOS App Life Cycle
3. Fundamental Architectural Design Patterns
4. App State Transitions
5. Building Responsive Apps
6. The SOLID Principles
7. Communication between Apps
8. Efficiency and Performance
Optimizing for performance3m 19s
Next steps1m 14s
- 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.