Skip to content

Support for Swift 6#48

Open
gitsino wants to merge 14 commits intomasterfrom
feature/swift-6-support
Open

Support for Swift 6#48
gitsino wants to merge 14 commits intomasterfrom
feature/swift-6-support

Conversation

@gitsino
Copy link
Collaborator

@gitsino gitsino commented Oct 6, 2025

No description provided.

@gitsino gitsino requested a review from nsimunko October 6, 2025 11:23
Base automatically changed from feature/unit-tests to master October 13, 2025 07:19
gitsino and others added 12 commits October 17, 2025 13:05
# Conflicts:
#	Example/Pods/Target Support Files/Locker/Locker-Info.plist
#	Example/Pods/Target Support Files/Locker/ResourceBundle-Locker_Locker-Locker-Info.plist
- Add @preconcurrency import for Foundation to suppress Sendable warnings
- Mark completion handlers as @sendable for thread-safe callbacks
- Add nonisolated(unsafe) to global mutable state (enableDeviceListSync, currentUserDefaults)
- Make DeviceManager final and Sendable
- Convert Keychain query dictionaries from [CFString: Any] to [String: Any]
- Move dictionary creation inside async blocks to avoid capturing non-Sendable types

The project now builds with zero concurrency warnings using -strict-concurrency=complete.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
# Conflicts:
#	Sources/Locker/Core/Locker.swift
- Add NSLock-based synchronization to Locker's global mutable state:
  - userDefaults/currentUserDefaults now uses lock-protected getter/setter
  - enableDeviceListSync converted from didSet to lock-protected computed property
- Make BundleHelpers final and Sendable with file operation locking
- Make LockerHelpers final and Sendable

This ensures proper thread safety at runtime while maintaining Swift 6
strict concurrency compatibility. The nonisolated(unsafe) markers on backing
storage indicate these variables are only accessed through lock-protected
computed properties.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 3 - Async/Await API:
- Add async setSecret(_:for:) for storing secrets
- Add async retrieveCurrentSecret(for:operationPrompt:) that throws RetrievalError
- Add async deleteSecret(for:) and reset(for:) methods
- Add RetrievalError enum (notFound, keychainError, invalidData)
- All async methods require iOS 13.0+

Phase 4 - MainActor Callbacks:
- Add setSecret(_:for:onMainActor:) with @mainactor completion
- Add retrieveCurrentSecret(for:operationPrompt:onMainActorSuccess:onMainActorFailure:)
- Callbacks are marked as @mainactor @sendable for full Swift 6 compliance

All 25 tests pass (14 TouchIDTests + 11 LockerHelpersTests).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove @mainactor isolation from DeviceManager.shared and
LockerHelpers.deviceManager since the DeviceManager class is
Sendable and its methods don't require main actor isolation.
- Unify all UserDefaults access through Locker.userDefaults, fixing
  divergence when a custom suite is configured (keychain service name
  and LA policy domain state previously read/wrote UserDefaults.standard
  directly). Includes one-time migration from .standard on first access.
- Replace nonisolated(unsafe) + NSLock in Locker with LockerState, a
  Sendable container that encapsulates all shared mutable state.
- Extract Keychain operations into KeychainHelper with async entry
  points; legacy callback APIs delegate via Task.detached, async APIs
  call KeychainHelper directly (no double-wrapping via continuations).
- Convert DeviceManager.fetchDevices() to async URLSession.data(from:).
- Align Package.swift with podspec: swift-tools-version 5.9, iOS 13,
  .swiftLanguageMode(.v6).
- Add 8 new tests covering custom-suite unification, migration,
  async store/retrieve/delete/reset, and legacy callback compatibility.
- Update README with async/await usage and custom UserDefaults docs.
Local Claude Code configuration (permission settings) is user-specific
and should not be tracked in version control.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant