Skip to content

[POC] Enable Swift 6 concurrency#963

Draft
mahmoud-elmorabea wants to merge 5 commits intomainfrom
enable-concurrency-flag
Draft

[POC] Enable Swift 6 concurrency#963
mahmoud-elmorabea wants to merge 5 commits intomainfrom
enable-concurrency-flag

Conversation

@mahmoud-elmorabea
Copy link
Contributor

@mahmoud-elmorabea mahmoud-elmorabea commented Oct 16, 2025

TBA


Note

Adopts Swift 5.9 with strict concurrency across the SDK, refactors networking and rich push to async/await, enforces Sendable/@mainactor, improves DI/thread-safety, and bumps minimum iOS to 15 with updated podspecs/projects/mocks/tests.

  • Concurrency & Language:
    • Enable strict concurrency (SWIFT_STRICT_CONCURRENCY=complete) and upgrade to Swift 5.9 across projects; SPM tools to 5.9.
    • Add Sendable, @MainActor, @preconcurrency, and @Sendable annotations throughout.
  • API & Async Refactors:
    • Convert HttpClient/HttpRequestRunner and rich push flows to async/await; update call sites and mocks.
    • Change several callbacks to @Sendable; many methods now async (e.g., rich push didReceive, metric tracking).
  • Thread-safety & DI:
    • Introduce EnhancedSynchronized for safe shared state; rework DIGraphShared to thread-safe singleton creation/storage.
    • Improve EventBus observer storage with synchronized access.
  • Modules & Config:
    • Update MessagingPush, APN, FCM, In-App to new async APIs; mark app delegate paths @MainActor where needed.
    • Remove TaskBag; adjust Atomic internals.
  • Build & Distribution:
    • Bump iOS deployment target to 15.0; update all Cocoapods podspecs to Swift 5.9 and iOS 15.
    • Apply Swift 5.9 and strict concurrency to sample apps (UIKit, CocoaPods, VisionOS).
  • Testing & Codegen:
    • Update tests to async/await; regenerate mocks and DI to reflect new signatures and concurrency changes.
    • Add dev notes on concurrency migration strategy.

Written by Cursor Bugbot for commit d5c1ee7. This will update automatically on new commits. Configure here.

@mahmoud-elmorabea mahmoud-elmorabea self-assigned this Oct 16, 2025
@mahmoud-elmorabea mahmoud-elmorabea requested a review from a team as a code owner October 16, 2025 20:39
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

await implementation.didReceive(request, withContentHandler: contentHandler)
}

return true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: SDK Notification Handling Breaks API Contract

The public didReceive method now always returns true and dispatches its work to an unawaited Task. This breaks the API contract where the return value indicates if the SDK handled the notification, potentially causing Notification Service Extensions to terminate before completing push processing.

Additional Locations (1)

Fix in Cursor Fix in Web

pushLogger.logTrackingPushMessageDelivered(deliveryId: pushCioDeliveryInfo.id)

trackMetricFromNSE(deliveryID: pushCioDeliveryInfo.id, event: .delivered, deviceToken: pushCioDeliveryInfo.token)
await trackMetricFromNSE(deliveryID: pushCioDeliveryInfo.id, event: .delivered, deviceToken: pushCioDeliveryInfo.token)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Async Refactor Breaks Parallelism, Affects Performance

The async/await refactor changed previously parallel operations, like metric tracking and rich push processing, into serial execution. This goes against the explicit comment in the code and may cause a performance regression in notification service extension processing.

Fix in Cursor Fix in Web

)

MessagingPush.shared.didReceive(request, withContentHandler: contentHandler)
Task { await MessagingPush.shared.didReceive(request, withContentHandler: contentHandler) }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Async Task Not Awaited in Notification Extension

The NotificationServiceExtension creates a Task for rich push processing but doesn't await its completion. Given the extension's limited execution time, this can lead to premature termination before the async work finishes, resulting in incomplete notification processing.

Fix in Cursor Fix in Web

Copy link
Contributor

@Shahroz16 Shahroz16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put this in draft?

@mahmoud-elmorabea mahmoud-elmorabea marked this pull request as draft October 21, 2025 09:05
@mahmoud-elmorabea mahmoud-elmorabea changed the title [WIP] Enable concurrency flag [WIP] Enable Swift 6 concurrency Oct 21, 2025
@mahmoud-elmorabea mahmoud-elmorabea changed the title [WIP] Enable Swift 6 concurrency [POC] Enable Swift 6 concurrency Oct 21, 2025
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.

2 participants