Swift Robustness & AsyncLesson 38Free preview
Swift Concurrency
This lesson is part of Swift · All levels
Summary
This lesson discusses the Modern Competition feature in Swift using the async/await, Tasks, and Actors models. Launched on Swift 5.5, this model replaced the callback closure that was vulnerable to bug-prone 'callback hell'. The developers will learn how asynchronous functions work as well as the role of the Actor in preventing data race.
Key points
- The asynchronous function is denoted by the keyword 'async' and is called 'await'
- Removing the cramped callback pyramid
- 'Task' is used to launch asynchronous operations from a synchronous context
- 'actor' is a type of reference thread-safe that automatically isolates and protects its internal state from data race
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.