8

iOS Concurrency with GCD and Operations [SUBSCRIBER]

 4 years ago
source link: https://www.raywenderlich.com/9461083-ios-concurrency-with-gcd-and-operations
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Getting Started

Introduction

8:29 Free

Find out what's in store for you as you work through this course and why it's important.

GCD

7:29

Learn about the different Grand Central Dispatch global queues and how they manage threads for you.

Develop your understanding of serial vs. concurrent queues and synchronous vs. asynchronous dispatch.

Learn how to create and execute a dispatch work item if you want to be notified when the task completes, or if you might need to cancel the task.

Practice using dispatch queues to download and display images, through a hands-on challenge.

Learn how to use the asynchronous URLSession API to download images in the background, then dispatch back to the main queue to display them.

Learn how to create your own asynchronous version of any function, where you can specify the run and completion queues.

Practice creating an asynchronous version of a function in a real app, through a hands-on challenge.

Learn about two reactive programming frameworks, which unify and coordinate the numerous asynchronous programming tools.

Conclusion

2:41

Let's review what you've learned about concurrency and dispatch queues and discuss what's next.

Grand Central Dispatch

Find out what you'll learn about concurrency in this part of the course, and why it's important.

Learn how to create a group of slow tasks, run them on a dispatch queue and be notified when they all finish.

Learn how to wrap an asynchronous function so you can run it in a dispatch group, and it tells the group when it really finishes.

In a hands-on challenge, practice wrapping the asynchronous function URLSession dataTask to download a group of images.

Learn how to use a dispatch semaphore to control the number of dispatch group tasks that run at the same time.

Learn how to prevent the three potential concurrency problems: priority inversion, data races and deadlocks.

Explore the priority inversion problem by creating a situation where a high-priority task must wait for lower-priority tasks.

Learn how to use Xcode's TSan tool to detect data races, then use a dispatch barrier to make a class threadsafe.

Practice using TSan and making a class threadsafe with a dispatch barrier, through a hands-on challenge.

Conclusion

2:55

Halfway through this course, let's review what you've learned about concurrency problems and dispatch groups and discuss what's next.

Operations I

Let's review what you'll be learning about Operations and OperationQueues in this part of the course, and why it's important.

Get started with Operations by learning how to create and use BlockOperations and what they're useful for.

Learn how to define a reusable operation, with input and output properties, as a subclass of Operation.

Discover the real power of Operations happens when you add them to an OperationQueue and let it handle scheduling and execution.

Explore how Operations run on an OperationQueue by executing the same set of tasks you used with BlockOperation.

In a hands-on challenge, practice using an OperationQueue to apply a tilt-shift filter to an array of images.

Find out what you need to do to run an asynchronous operation in an OperationQueue, so the OperationQueue knows when it really finishes.

Create an AsyncOperation subclass of Operation to handle Operation state changes, then subclass AsyncOperation to wrap an asynchronous function.

In a hands-on challenge, practice subclassing AsyncOperation to wrap the image download task, then create instances to download an array of images.

Conclusion

0:55

Let's review what you've learned in this part about Operations, OperationQueues and AsyncOperations, and discuss what's next.

Operations II

Find outwhat you'll be learning in this part of the course about canceling or defining dependencies on Operations and about Core Data and SwiftUI with Combine.

Learn how to set up a dependency between two operations so an OperationQueue can run them in the correct order.

In a hands-on challenge, practice defining an Operation dependency to apply the tilt-shift filter after an image finishes downloading.

Learn how to cancel download and filter operations in the sample app, if an image's cell scrolls off the screen.

Learn the wrong way and the right way to share a Core Data NSManagedObject between threads in an app.

Take a walk through a SwiftUI+Combine version of the Concurrency app, using Publishers to download and tilt-shift filter images.

Conclusion

1:46

Let's review everything you've learned in this course about Grand Central Dispatch, concurrency problems, Operations and OperationQueues.


Recommend

  • 10
    • blog.danthought.com 3 years ago
    • Cache

    iOS 基础 - GCD 和 Operation

    一些 iOS 基础知识,业务开发中经常用到,面试时也常会被问到,这里总结一下,此篇文章讲解 GCD 和 Operation。 Thread 使...

  • 8
    • www.mikeash.com 3 years ago
    • Cache

    Blocks and GCD in Russian

    Blocks and GCD in Russianmikeash.com: just this guy, you know? Blocks and GCD in Russian by Mike Ash   Alexander Babaev has been kind enough to tr...

  • 7
    • www.cnblogs.com 3 years ago
    • Cache

    iOS刨根问底-深入理解GCD

    做过iOS开发的同学相信对于GCD(Grand Central Dispatch)并不陌生,因为在平时多线程开发过程中GCD应该是使用最多的技术甚至它要比它的上层封装NSOperation还要常用,...

  • 4
    • yaoguais.github.io 2 years ago
    • Cache

    iOS中GCD的实现与总结

    iOS中GCD的实现与总结 GCD全称"Grand Central Dispatch", 中央调度的意思, 是iOS中标准异步处理的技术. 为什么会产生GCD呢, 这个跟其他语言类比下, 在Java中多使用线程, Erlang中使用协程, 其中协程比线程更加轻量更加优雅, 而iOS中的GCD就可以类比...

  • 9
    • www.raywenderlich.com 1 year ago
    • Cache

    Modern Concurrency: Getting Started [SUBSCRIBER]

    Modern Concurrency: Getting Started Group Group Group...

  • 3

    AsyncStream & Continuations Introduction...

  • 6

    Modern Concurrency in Swift Group Group Group

  • 5
    • hanleylee.com 1 year ago
    • Cache

    iOS 开发中 GCD 使用

    现在的智能设备都是多核心, 如果想让 App 充分利用多核心的性能优势, 则必须掌握多线程管理技术, 多线程管理在 iOS 开发中叫做 GCD

  • 3
    • www.kodeco.com 1 year ago
    • Cache

    Concurrency by Tutorials [SUBSCRIBER]

    Dive Into Concurrency in Your iOS Apps! What is concurrency, and why would you even want to use it in your apps? Find out everything you need to know in this book. Learn about Grand Central Dispatch, Apple’s implementatio...

  • 6

    Learning path This is part of the Concurrency in iOS learning path.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK