This e book is for intermediate iOS builders who already know the fundamentals of iOS and Swift
improvement however wish to learn to make their app effectively carry out duties with out
affecting efficiency, and methods to correctly divide work to make the most of {hardware} to the fullest extent.
Grand Central Dispatch
Operations & Operation Queues
Widespread Concurrency Issues
Threads & Thread Sanitizer
What’s concurrency, and why would you even wish to use it in your apps? Discover out all the pieces you could know on this e book. Find out about Grand Central Dispatch, Apple’s implementation of C’s libdispatch, also called GCD — one of many…
extra
This part tells you just a few issues you could know earlier than you get began, corresponding to what you’ll want for {hardware} and software program, the place to seek out the venture information for this e book and extra.
On this a part of the e book, you’re going to study in regards to the fundamentals of Concurrency. You’re going to study what it’s, what sort of issues it solves and when and the way you’d use it.
Moreover, you’ll study the essential items which comprise Concurrency in iOS improvement: Grand Central Dispatch and Operations.
This part will give you foundational data concerning Concurrency, so you’ll want to learn it via! The upcoming sections will dive a lot deeper into every of those ideas individually.
Get a fast overview of what concurrency is and why you may wish to use it.
Concurrency will be dealt with by both Grand Central Dispatch (GCD) or Operations. Be taught in regards to the variations.
On this part, you’ll take a deep dive into Apple’s hottest and easy-to-use mechanism to write down and handle concurrent duties — Grand Central Dispatch. You’ll learn to make the most of queues and threads to regulate the execution of duties in your app, in addition to methods to group these duties collectively. You’ll additionally find out about widespread pitfalls and risks of utilizing concurrency, and how one can keep away from them.
This chapter teaches you methods to use a GCD queue to dump work from the primary thread. You will additionally study what a “thread” is.
Within the earlier chapter you discovered about how queues work. On this chapter you will increase that data to learn to submit a number of duties to a queue which have to run collectively as a “group” so that you could be notified after they have all accomplished. You will additionally learn to wrap an present API so that you could name it asynchronously.
By now you know the way GCD could make your app a lot quicker. This chapter will present you a few of the risks of concurrency for those who’re not cautious, and methods to keep away from them.
Although Grand Central Dispatch supplies many of the concurrency capabilties you’ll want proper out-of-the-box, typically you’ll need some additional customizability. That is the place Operations come into play. This part will educate you about Operations, Operation Queues and all the pieces in between.
On this chapter you will change gears and begin studying in regards to the Operations class, which permits for rather more highly effective management over your concurrent duties.
Much like the Dispatch Queues you discovered about again in Chapter 3, the Operation class makes use of an OperationQueue to carry out an analogous perform.
Now that you would be able to create an Operation and submit it to a queue, you will learn to make the operation itself asynchronous. Whereas not one thing you will do often, it is essential to know that it is potential.
The “killer characteristic” of Operations is having the ability to inform the OS that one operation depends on one other and should not being till the dependency has completed.
There are occasions when you could cease an operation that’s working, or has but to begin. This chapter will educate you the ideas that you just want to pay attention to to assist cancelation.
To wrap up this e book, this part might be devoted to displaying you the way you should utilize the data you’ve accrued all through this e book for real-life functions.
On this part, you’ll take a deeper dive into a typical case the place concurrency performs an enormous function — Core Information — in addition to find out about Apple’s Thread Sanitizer, a fantastic instrument to debug and resolve concurrency points and confusions.
Core Information works properly with concurrency so long as you retain just a few easy guidelines in thoughts. This chapter will educate you methods to ensure that your Core Information app is ready to deal with concurrency correctly.
Information races happen when a number of threads entry the identical reminiscence with out synchronization and at the very least one entry is a write. This chapter will educate you methods to use Apple’s Thread Sanitizer to detect knowledge races.