Problem
The codebase mixes completion handlers and async/await patterns inconsistently.
Examples
// AuthenticationManager.swift - closure-based
func registrationOptions(accountName: String, completion: @escaping (Data?, Data?) -> Void)
// ArkavoApp.swift - async/await
private func saveProfile(profile: Profile) async -> Bool
Impact
- Callback hell in some code paths
- Inconsistent error handling patterns
- Difficulty composing async operations
- Mental overhead switching between patterns
Solution
- Convert all completion handlers to async/await
- Use
withCheckedContinuation for bridging legacy APIs
- Standardize error handling with
throws
- Update all call sites
Files to Update
AuthenticationManager.swift - Multiple completion handlers
ArkavoClient callbacks
- Network layer methods
Acceptance Criteria
Problem
The codebase mixes completion handlers and async/await patterns inconsistently.
Examples
Impact
Solution
withCheckedContinuationfor bridging legacy APIsthrowsFiles to Update
AuthenticationManager.swift- Multiple completion handlersArkavoClientcallbacksAcceptance Criteria
throwsfor error handling