This ebook is for intermediate iOS builders who already know the fundamentals of iOS and Swift
improvement however need to discover ways to make their app effectively carry out duties with out
affecting efficiency, and 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 need to use it in your apps? Discover out every thing it is advisable know on this ebook. Find out about Grand Central Dispatch, Apple’s implementation of C’s libdispatch, also called GCD — one of many…
extra
This part tells you a couple of issues it is advisable know earlier than you get began, reminiscent of what you’ll want for {hardware} and software program, the place to search out the venture recordsdata for this ebook and extra.
On this a part of the ebook, you’re going to study concerning the fundamentals of Concurrency. You’re going to study what it’s, what sort of issues it solves and when and the way you’ll use it.
Moreover, you’ll study the fundamental items which comprise Concurrency in iOS improvement: Grand Central Dispatch and Operations.
This part will offer you foundational information relating to Concurrency, so make sure to learn it by way of! 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 would possibly need to use it.
Concurrency might be dealt with by both Grand Central Dispatch (GCD) or Operations. Be taught concerning the variations.
On this part, you’ll take a deep dive into Apple’s hottest and easy-to-use mechanism to put in writing and handle concurrent duties — Grand Central Dispatch. You’ll discover ways to make the most of queues and threads to regulate the execution of duties in your app, in addition to group these duties collectively. You’ll additionally find out about frequent pitfalls and risks of utilizing concurrency, and how one can keep away from them.
This chapter teaches you use a GCD queue to dump work from the principle thread. You will additionally study what a “thread” is.
Within the earlier chapter you discovered about how queues work. On this chapter you may broaden that information to discover ways to submit a number of duties to a queue which have to run collectively as a “group” so to be notified once they have all accomplished. You will additionally discover ways to wrap an current API so to name it asynchronously.
By now you know the way GCD could make your app a lot sooner. This chapter will present you a number of the risks of concurrency in the event you’re not cautious, and keep away from them.
Despite the fact that Grand Central Dispatch gives many of the concurrency capabilties you’ll want proper out-of-the-box, typically you’ll need some further customizability. That is the place Operations come into play. This part will educate you about Operations, Operation Queues and every thing in between.
On this chapter you may swap gears and begin studying concerning the Operations class, which permits for way more highly effective management over your concurrent duties.
Just like the Dispatch Queues you discovered about again in Chapter 3, the Operation class makes use of an OperationQueue to carry out the same perform.
Now that you could create an Operation and submit it to a queue, you may discover ways to make the operation itself asynchronous. Whereas not one thing you may do frequently, it is necessary to know that it is attainable.
The “killer function” of Operations is with 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 it is advisable cease an operation that’s working, or has but to begin. This chapter will educate you the ideas that you just want to concentrate on to assist cancelation.
To wrap up this ebook, this part might be devoted to exhibiting you the way you need to use the information you’ve accrued all through this ebook for real-life functions.
On this part, you’ll take a deeper dive into a standard case the place concurrency performs an enormous function — Core Information — in addition to find out about Apple’s Thread Sanitizer, a fantastic software to debug and resolve concurrency points and confusions.
Core Information works nicely with concurrency so long as you retain a couple of easy guidelines in thoughts. This chapter will educate you guarantee 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 least one entry is a write. This chapter will educate you use Apple’s Thread Sanitizer to detect information races.