Concurrency by Tutorials: Multithreading in Swift with GCD and Operations

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Dive into Concurrency in iOS apps! Concurrency is the concept of multiple things, or pieces of work, running at the same time. With the addition of CPU cores in our devices, knowing how to properly utilize your customer's hardware to the maximum is absolutely a must. However, proper concurrency in iOS apps is one of the lesser-known topics that every developer wants to (and should) understand properly, but is usually intimidated by. This is where Concurrency by Tutorials comes to the rescue! In this book, you’ll learn everything there is to know about how to write performant and concurrent code for your iOS apps. Who This book Is For This book is for intermediate iOS developers who already know the basics of iOS and Swift development but want to learn how to make their app efficiently perform tasks without affecting performance, and how to properly divide work to utilize hardware to the fullest extent. What & Why: Learn what is Concurrency and why would you even want to utilize it in your apps? Grand Central Dispatch: Learn about Apple's implementation of C's libdispatch, also known as GCD, it's one of the simplest ways to queue up tasks to be run in parallel. Operations & Operation Queues: When GCD doesn't quite cut it, you'll learn how to further customize and reuse your concurrent work using Operations and Operation Queues. Common Concurrency Problems: Learn about some of the problems you could face while developing concurrent applications, such as Race Conditions, Deadlocks, and more. Threads & Thread Sanitizer: Understand various threading-related concepts and how these connect to the knowledge you've accumulated throughout this book. You'll also learn how to use Thread Sanitizer to ease your debugging when things go wrong. This book is sure to make you a pro in building concurrent and performant appllications, and finally understanding how these lower-level APIs work to the fullest, pushing your app to the top! About Scott Grosch Scott Grosch has been involved with iOS app development since the first release of the public SDK from Apple, and spends his days as a Solutions Architect at a Fortune 500 companyin the Pacific Northwest.

Author(s): Scott Grosch
Edition: 2
Publisher: Razeware LLC
Year: 2019

Language: English
Commentary: Up to date to iOS 13, Xcode 11 & Swift 5.1

About the Cover
About the Author
About the Editors
About the Artist
Acknowledgements
What You Need
Book License
Book Source Code & Forums
Chapter 1: Introduction
What is concurrency?
Why use concurrency?
How to use concurrency
Where to go from here?
Chapter 2: GCD & Operations
Grand Central Dispatch
Operations
Which should you use?
Where to go from here?
Chapter 3: Queues & Threads
Threads
Dispatch queues
Image loading example
DispatchWorkItem
Where to go from here?
Chapter 4: Groups & Semaphores
DispatchGroup
Semaphores
Where to go from here?
Chapter 5: Concurrency Problems
Race conditions
Deadlock
Priority inversion
Where to go from here?
Chapter 6: Operations
Reusability
Operation states
BlockOperation
Subclassing operation
Chapter 7: Operation Queues
OperationQueue management
Fix the previous project
Where to go from here?
Chapter 8: Asynchronous Operations
Asynchronous operations
Networked TiltShift
Where to go from here?
Chapter 9: Operation Dependencies
Modular design
Specifying dependencies
Watch out for deadlock
Passing data between operations
Updating the table view controller
Where to go from here?
Chapter 10: Canceling Operations
The magic of cancel
Cancel and cancelAllOperations
Updating AsyncOperation
Canceling a running operation
Where to go from here?
Chapter 11: Core Data
NSManagedObjectContext is not thread safe
Importing data
NSAsynchronousFetchRequest
Sharing an NSManagedObject
Where to go from here?
Chapter 12: Thread Sanitizer
Why the sanitizer?
Getting started
Enabling sanitization
It’s not code analysis
Xcode keeps getting smarter
Where to go from here?
Conclusion