@adam_zethraeus@jaick_pp@DEPENDENCY I think Brandon offered a fair rebuttal on Mastodon, if you missed it. Calling the library “fundamentally dangerous” seems hyperbolic at best, no?
To celebrate #WWDC26 we are running a rare 30%-off sale!
Gain a deep understanding of advanced Swift topics, AI skills, beta previews, and much, much more: https://t.co/T57lAs8R5I
This week we dissect “sending” closures, how they power the common Task {} API, and how they track their capture of non-sendable objects in safe ways.
Watch us break it down, step-by-step: https://t.co/MeKYfOiF58
Swift concurrency is complex and difficult to understand, but once you do you have a superpower at your fingertips other languages could only dream of.
We spend hours and hours making it as approachable as possible. If you’re struggling with the topic, watch our entire series on isolation today: https://t.co/P9SPNf2rNh
Region-based isolation can get tricky when it comes to closures, especially 'inout' arguments and nested closures. We will take things slowly to understand this topic fully, and even employ a trick we discussed on just the 2nd episode of Point-Free!
👉 https://t.co/MeKYfOi7fA
A thorny aspect to Xcode's default settings that we did not appreciate until today: app targets have default main actor isolation, but test targets do not, and all targets are in Swift 5 mode.
That means tests do not exercise how your code will really behave in production.
A brand new library from Point-Free!
DebugSnaphots can instantly make your classes and @Observable models debuggable and testable. Simply apply the macro and get insight into how data changes over time, and write exhaustive tests on your feature's logic.
https://t.co/BrURfM0Jip
You too can *finally* understand the concepts of region-based isolation!
We poke around all the ways that regions are defined and merged, and how values transfer between regions, allowing you to write permissive code that is 100% concurrency safe.
👉 https://t.co/eGGB1GAjlO
The 'sending' parameter is a concurrency tool that allows you to specify how non-Sendable values cross isolation boundaries. We explore how it works by sending disconnected objects into and out of isolation domains.
https://t.co/ZVm7gh1vTc
This week we meticulously analyze various async functions line-by-line in order to see how isolation regions evolve and how values transfer between regions.
This allows us to better understand how non-Sendable objects can be sent across isolation boundaries in a safe manner.
“Region-based isolation” expanded the definition of isolation beyond actors to something called “regions.” Learn what a region is, how they work, and how they loosened the overly strict sendability rules of Swift 5.
https://t.co/BcDCikKY22
Do you know about Swift 6.2’s “nonisolated(nonsending)”?
You may be benefiting from it and not even realize! You’re even already using it if you turned on “approachable concurrency.”
It helps you avoid a whole class of concurrency errors that plagued earlier versions of Swift.
In Swift's original vision for concurrency all nonisolated async functions hopped to a concurrent executor. This seemed good since it maximized concurrency, but it made non-Sendable values unusable.
Approachable concurrency solves that problem! Learn how: https://t.co/zmXKfACwfs
Swift 6.2 introduced a vision for “approachable concurrency.” This includes two new features that make working with async code much easier: nonisolated-nonsending, and actor-isolated conformances. Let’s explore each topic and see how they improve things.
https://t.co/zmXKfACwfs
Naive benchmarks may suggest actors lag mutexes and locks, but these constructs just aren’t apples-to-apples:
• Actor suspension is much gentler on the CPU than the act of acquiring a lock
• Actor suspension points are more easily squashed than “withLock”
This week we are making use of the fantastic package-benchmark project for benchmarking Swift code. It helps you avoid many common pitfalls of benchmarks, such as not running in release, not warming up your code paths, and focusing only on wall time.
👉 https://t.co/FcF5cElDqK
It's easy to write a naive benchmark that “proves” actors are 25-50% slower than locks. But such benchmarks hardly ever tell the full story and can be very misleading.
We attack this thorny problem head on in this week's episode.
https://t.co/rHUgjpsd67