A comprehensive test suite exploring the latest changes and improvements in Swift Concurrency, focusing on Swift 6 and newer Swift Evolution proposals.
ConcurrencyPlayground is a collection of test cases demonstrating the implementation and usage of various Swift Evolution proposals related to concurrency. It serves as both a learning resource and a verification tool for understanding how different concurrency features work in Swift.
The project contains implementation tests of the following Swift Evolution proposals:
-
SE-0401: Remove Actor Isolation Inference caused by Property Wrappers - Demonstrates changes to property wrapper isolation rules.
-
SE-0411: Isolated default value expressions - Tests isolation rules for default values.
-
SE-0414: Region based Isolation - Tests region-based actor isolation rules.
-
SE-0417: Task Executor Preference - Shows task executor customization with preferences.
-
SE-0418: Inferring
Sendablefor methods and key path literals - Tests automaticSendableinference improvements. -
SE-0420: Inheritance of actor isolation - Demonstrates dynamic actor isolation inheritance rules.
-
SE-0421: Generalize effect polymorphism for
AsyncSequenceandAsyncIteratorProtocol- TestsAsyncSequenceandAsyncIteratorProtocolimprovements. -
SE-0423: Dynamic actor isolation enforcement from non-strict-concurrency contexts - Tests new usage of
@preconcurrencyattribute. -
SE-0424: Custom isolation checking for SerialExecutor - Shows custom executor implementation with isolation checking.
-
SE-0430:
sendingparameter and result values - Tests safe transfer of non-sendable values between actors. -
SE-0431:
@isolated(any)Function Types - Demonstrates new isolation parameter for closures. -
SE-0434: Usability of global-actor-isolated types - Tests global actor isolation improvements for value types and closures.
Each test file contains detailed examples and edge cases for the corresponding proposal implementation. The test suite helps verify the behavior of these new concurrency features and serves as a learning resource for understanding Swift's evolving concurrency model.
Clone the repository and open Package.swift in Xcode:
-
Feel free to change
swiftLanguageModesinPackage.swiftto Swift 5 and investigate language difference. -
Switch between targets with
iOS 17andiOS 18to check different runtime behaviour.