Enable Swift 6 language mode#582
Conversation
Convert ThreadSafeDictionary to an actor wrapper to modernize concurrency standards
|
Hi @maxim-chipeev, |
…sMarcal/Swinject into lucas/adopt-swift-6-language-mode
Hi, working on getting this PR merged ASAP |
|
@0xLucasMarcal @maxim-chipeev |
Enable Swift 6 Language Mode
This PR updates Swinject to fully embrace Swift 6.0 and modern Swift concurrency patterns. The changes include both tooling updates and code modernization to leverage Swift 6's features.
It still requires some more profound changes if we want to adopt Swift Concurrency fully, but it seems the case since we want to prioritize performance over using the latest features. In the majority of cases, using an actor or Mutex from the Synchronization framework is twice as slow as using the traditional lock/Fair Lock mechanisms.
Key Changes
Tooling Updates
Code Modernization
SWINJECT_LOGGING_ENABLED)ThreadSafeDictionaryfrom lock-based to actor-based implementationSendableconformance to key typesObjectScopedefinitions into a single fileReadWriteLockimplementation in favor of actor-based concurrencyObjectScopeafinalclass and marked it as@unchecked SendableMigration Notes
SWINJECT_LOGGING_ENABLED=1environment variableThreadSafeDictionarymay need to be updated to handle the actor-based implementationTesting
Please ensure to test thoroughly, especially in concurrent scenarios, as this update includes significant changes to thread safety mechanisms.