Adopt Swift 6 language mode for Domain target#98
Draft
tosh7 wants to merge 3 commits into
Draft
Conversation
Set SWIFT_VERSION to 6.0 for the Domain framework (Debug and Release) to enable Swift 6 language mode and strict concurrency checking on shared business logic.
Adopt Sendable across the API layer so it compiles under Swift 6 language mode without data-race warnings. - ApiClient: make stored properties immutable (let) and conform to Sendable; remove the unused updateConfiguration mutator - Mark value types Sendable: APIClientConfiguration, RetryPolicy, APIError, HTTPMethod, DeliveryCarrierType, UnifiedDeliveryStatus, UnifiedDeliveryInfo - DeliveryCacheProtocol: require Sendable; conform the cache implementations (memory/disk use @unchecked Sendable backed by NSLock and stateless file IO, tiered cache is checked Sendable)
Move the cache implementations to compiler-checked Sendable instead of manual @unchecked guarantees. - DeliveryMemoryCache: store entries in a Mutex instead of a var dict guarded by NSLock - DeliveryDiskCache: drop the non-Sendable stored FileManager/encoder/ decoder and create them locally per call so the type is checked Sendable - CacheEntry: add conditional Sendable conformance (where T: Sendable)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SWIFT_VERSION = 6.0, Debug + Release).Sendableso it compiles cleanly under strict concurrency.Changes
let) and the type conforms toSendable. Removed the unusedupdateConfigurationmutator (the singleton was never reconfigured at runtime).Sendable:APIClientConfiguration,RetryPolicy,APIError,HTTPMethod,DeliveryCarrierType,UnifiedDeliveryStatus,UnifiedDeliveryInfo.DeliveryCacheProtocolnow requiresSendable.DeliveryMemoryCache/DeliveryDiskCache:@unchecked Sendable(memory cache isNSLock-protected; disk cache relies on file IO).DeliveryTieredCache: checkedSendable.Open question / follow-up
@unchecked Sendablecaches rely on manual guarantees rather than compiler-checked safety. If the deployment target allows iOS 18+, migrating the memory cache toSynchronization.Mutex(or anactor) would make it checked-safe. Left as a follow-up.Test plan
Domaintarget builds under Swift 6 language mode