pocket-casts-ios
pocket-casts-ios copied to clipboard
Swift 6 and Strict Concurrency Checking
This is a summary of an audit trying to build the project using Xcode 16.0 Beta 1 and Swift 6 enabled.
Given Swift 6 has Complete
Strict Concurrency Checking
the app doesn't build. These are the build errors organized by the number of occurrences:
- [ ] 79 occurrences:
Reference to class property 'appSettings' is not concurrency-safe because it involves shared mutable state
- [ ] 19 occurrences:
Static property 'X' is not concurrency-safe because it is non-isolated global shared mutable state
- [ ] 12 occurrences:
Capture of 'self' with non-sendable type '?' in a
@Sendableclosure
- [ ] 12 occurrences:
Main actor-isolated property '?' can not be referenced from a non-isolated context
- [ ] 11 occurrences:
Call to main actor-isolated instance method '?' in a synchronous nonisolated context
- [ ] 7 occurrences:
Main actor-isolated class property '?' can not be referenced from a non-isolated context
- [ ] 6 occurrences:
Call to main actor-isolated initializer '?' in a synchronous nonisolated context
- [ ] 4 occurrences:
Class property '?' is not concurrency-safe because non-'Sendable' type '?' may have shared mutable state
- [ ] 3 occurrences:
Main actor-isolated property '?' can not be mutated from a non-isolated context
Discussion
The build errors related to appSettings
are somewhat straightforward to deal with: we can just delete it as it's part of a feature we abandoned.
The big issues are on the usage of static properties (and yes, Singletons): we'll have to ensure each and every one of them is concurrent safe. PodcastDataManager
is an example of a concurrent-safe class, which updates the cachedPodcasts
in a safe way.