In the first part of this chapter, we covered multithreading concurrency and multi-core device architecture. This general information allows us to understand the core principles of concurrent code execution.
In the second part, we covered three ways to run code asynchronously in Swift, by using threads, GCD, and NSOperation. We have explored the differences between them and the situations for which each is most suitable.
In the third part of the chapter, we concentrated on architecting asynchronous Swift code by using GCD. We have covered important tips such as passing a callback function parameter, avoiding a state, using immutable values, and others. Also, we have covered two Swift attributes—@noescape
and @autoclosure
—that are very useful.
In the next chapter, we will cover one more important performance optimization technique: Lazy Loading.