10 posts tagged ‘Swift Concurrency’
Swift Concurrency in Real Apps
Bryan Jones: Consider this code, wherein we create a custom NSTableColumn that uses an image instead of a String as its header. Holly Borla posted a fix that special-cases NSObject.init(): Now, overriding NSObject.init() within a @MainActor-isolated type is difficult-to-impossible, especially if you need to call an initializer from an intermediate superclass that is also @MainActor-isolated. […]
Issues Adopting Swift Testing
I’m in the process of migrating from XCTest to Swift Testing. The basic stuff is pretty easy to translate, and in many cases I don’t even need to change the code inside my test methods. I’ve long been writing what Swift Testing calls expectations in terms of my own helper functions such as eq(), unwrap(), […]
Forked
Drew McCormack (Mastodon): I’m launching a new Swift framework called Forked for working with shared data, both on a single device, and across many.[…]The merging that @ForkedModel provides is pretty powerful. It does property-wise merging of structs, and if you attach the @Merged attribute, you can add your own custom merging logic, or use the […]
Xcode 16.2
Apple (downloads): The Command Line Tools package now supports using the swift test command to build and run package tests written with Swift Testing.[…]Sometimes running parallel Tests on macOS run destinations never finishes.[…]macOS projects that use hardened runtime but no sandboxing may run into timeout errors when attempting to preview if the project is complex […]
Watch Out for Counterintuitive Implicit Actor-Isolation
Jared Sinclair: I ran into some unexpected runtime crashes recently while testing an app on iOS 18 compiled under Swift 6 language mode, and the root causes ended up being the perils of using @unchecked Sendable in combination with some counterintuitive compiler behavior with implicit actor isolation.[…]What occurred to me instead was to find a […]
Swift Vision: Improving the Approachability of Data-Race Safety
Holly Borla (via Mastodon, forum): This document lays out several potential paths for improving the usability of Swift 6, especially in simple situations where users aren’t intending to use concurrency at all. […] A key tenet of our thinking in this vision is that we want to drastically reduce the number of explicit concurrency annotations […]
Swift Concurrency Proposal Index
Quinn (via Fatbobman): This post summarises the Swift Evolution proposals that went into the Swift concurrency design. It covers the proposal that are implemented in Swift 6.0, plus a few additional ones that aren’t currently available.The focus is here is the Swift Evolution proposals. For general information about Swift concurrency, see the documentation referenced by […]
Problematic Swift Concurrency Patterns
Matt Massicotte: I think the vast majority of the time, a global actor should be applied to the type as a whole, not to individual properties.[…]But, while detached does prevent isolation inheritance, it also does other stuff too. Detached tasks do not inherit priority or task-local values. Instead, think about a nonisolated function.[…]I think MainActor.run […]