Friday, December 8, 2023
HomeiOS DevelopmentFashionable Concurrency in Swift |

Fashionable Concurrency in Swift |

Grasp Swift’s new concurrency mannequin!

For years, writing highly effective and secure concurrent apps with Swift might simply flip into a frightening process, stuffed with race circumstances and unexplained crashes hidden in a large nesting of callback closures.

In Swift 5.5, Apple launched a brand new concurrency mannequin that includes the async/await syntax, to allow you to write asynchronous code that reads like synchronous code. However like all new characteristic, right here be dragons! So how will you obtain the much-desired mastery of Fashionable Swift Concurrency?

Fashionable Concurrency in Swift is right here for the rescue, showcasing every part you could learn about async/await, duties, actors, and every part in between!

Earlier than You Start

This part tells you a number of issues you could know earlier than you get began, resembling what you’ll want for {hardware} and software program, the place to search out the undertaking information for this ebook, and extra.

Part I: Fashionable Concurrency in Swift

Get to know the trendy Swift concurrency mannequin, then take a deep dive into async code by engaged on a real-time inventory buying and selling undertaking.

Go into extra element about how the async/await syntax and the cooperative asynchronous execution work. Moreover, it introduces the utilization of “async let” to design concurrent code and the “Activity” sort which encapsulates asynchronous execution within the trendy concurrency mannequin.

Work with async sequences in additional element, proxying Mix to async/await code and managing async duties.

Create customized asynchronous sequences by leveraging AsyncStream, which helps you to wrap current asynchronous work in your app as an asynchronous sequence with out breaking a sweat.

Find out about continuations, that are a solution to manually handle suspended capabilities. You will use them to bridge between current non-async/await code and trendy, concurrent APIs.

Develop an asynchronous testing infrastructure and be taught all of the ins-and-outs of testing asynchronous code within the new concurrency mannequin. You will wrap up by including unit assessments to the Blabber undertaking you labored on in earlier chapters.

Create dynamic concurrency with Activity Teams, which allow you to run an arbitrary variety of duties concurrently and gives a pure sequence interface to entry and iterate over the outcomes of these duties.

Actor is the brand new Swift sort that transparently protects its mutable state from information races in a synchronized container, making concurrent programming a lot safer.

Now that you recognize actors, you may study a particular subset of them — international actors, which permit simple and secure entry to shared assets from anyplace in your app.

Create a distributed system that makes use of actors to execute concurrent duties on a number of units over the native community.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments