Skip to content

SDK-5963 Swift 6 support #961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed

SDK-5963 Swift 6 support #961

wants to merge 17 commits into from

Conversation

NandanPrabhu
Copy link
Contributor

@NandanPrabhu NandanPrabhu commented May 22, 2025

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

This PR has major changes in the SDK to enable strict swift concurrency from Swift 6 in the SDK
Conforming protocols and structs to Sendable
Converting classes to Actor wherever required

📎 References

🎯 Testing

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
vidhyamanisankar vidhyamanisankar
@NandanPrabhu NandanPrabhu changed the title Feature/sdk 5963 SDK-5963 Swift 6 support May 22, 2025
@NandanPrabhu NandanPrabhu marked this pull request as ready for review May 29, 2025 05:33
@NandanPrabhu NandanPrabhu requested a review from a team as a code owner May 29, 2025 05:33
@@ -51,15 +51,15 @@ public struct WebAuthentication {
/// - Parameter url: The URL sent by the external user agent that contains the result of the web-based operation.
/// - Returns: If the URL was expected and properly formatted.
@discardableResult
public static func resume(with url: URL) -> Bool {
return TransactionStore.shared.resume(url)
public static func resume(with url: URL) async -> Bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change, as it's making async a previously sync function.

}

/// Terminates the ongoing web-based operation and reports back that it was cancelled.
/// You need to call this method within your custom Web Auth provider implementation whenever the operation is
/// cancelled by the user.
public static func cancel() {
TransactionStore.shared.cancel()
public static func cancel() async {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change, as it's making async a previously sync function.


/// Tears down the external user agent after the web-based operation completed, if needed.
/// Auth0.swift will call this method after the callback URL was received and processed, or after the user
/// cancelled the operation, or after any other error occurred.
///
/// - Parameter result: The outcome of the web-based operation, containing either an empty success case or an
/// error.
func finish(with result: WebAuthResult<Void>)
func finish(with result: WebAuthResult<Void>) async
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change, as it's making async a previously sync function.


/// Starts the external user agent.
func start()
func start() async
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change, as it's making async a previously sync function.


/// Thunk that returns a function that creates and returns a ``WebAuthUserAgent`` to perform a web-based operation.
/// The ``WebAuthUserAgent`` opens the URL in an external user agent and then invokes the callback when done.
///
/// ## See Also
///
/// - [Example](https://github.com/auth0/Auth0.swift/blob/master/Auth0/SafariProvider.swift)
public typealias WebAuthProvider = (_ url: URL, _ callback: @escaping WebAuthProviderCallback) -> WebAuthUserAgent
public typealias WebAuthProvider = (_ url: URL, _ callback: @escaping @Sendable WebAuthProviderCallback) async -> WebAuthUserAgent
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change, as it's making async a previously sync function.
Same for all the other similar changes in this file.

return UIApplication.shared()?.windows.last(where: \.isKeyWindow) ?? ASPresentationAnchor()
}
#endif

#if os(visionOS)
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
nonisolated func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be nonisolated if this is UI-related code that needs to run on the main thread?

@NandanPrabhu
Copy link
Contributor Author

Closed this PR as would create a PR with breaking down the changes not present and strict Swift concurrency is supported

@NandanPrabhu NandanPrabhu reopened this Jun 3, 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.

None yet

3 participants