Skip to content

Ensure Swift 5 compilation for SDK pods to improve Swift 6 compatibility #1203

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

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

subhankarmaiti
Copy link
Contributor

This PR addresses build failures on iOS when the consuming application project is configured to use Swift 6, as discussed in issue #1185. While react-native-auth0 and its dependencies do not yet officially support Swift 6 features, this change ensures the SDK itself is explicitly compiled using Swift 5. It also updates documentation to guide users on how to enforce Swift 5 for all relevant SDK dependencies if they encounter issues.

Changes Made

  1. A0Auth0.podspec:

    • Added s.swift_version = '5.0' to explicitly declare that the A0Auth0 pod (which is react-native-auth0 itself) should be compiled with Swift 5.0. This instructs Cocoapods to use the Swift 5 compiler for this pod, even if the main application project defaults to Swift 6.
  2. README.md:

    • Updated the "Troubleshooting" section with more comprehensive guidance for users whose main application projects use Swift 6.
    • The post_install hook example in the README.md now includes JWTDecode and SimpleKeychain in addition to Auth0 and A0Auth0. This ensures that users can enforce Swift 5.0 compilation for all key Swift-based dependencies of the react-native-auth0 SDK, providing a more robust solution against potential build system overrides.
    • Updated manual Xcode steps to include checking JWTDecode and SimpleKeychain.

Context

  • The primary Swift dependencies of react-native-auth0 are Auth0.swift, JWTDecode, and SimpleKeychain. These libraries generally specify Swift 5 in their own podspecs.
  • This PR makes the Swift 5 requirement explicit for the react-native-auth0 pod itself.
  • The README.md update provides a stronger fallback for users by allowing them to explicitly set the Swift version for all these dependencies in their own project's Podfile.

Expected Outcome

Users with application projects set to Swift 6 should be able to build their iOS apps without encountering Swift version compatibility errors originating from react-native-auth0 or its direct Swift dependencies, as these will be compiled using Swift 5.

Related Issue

Closes #1185

@subhankarmaiti subhankarmaiti requested a review from a team as a code owner June 9, 2025 05:35
@subhankarmaiti subhankarmaiti merged commit 73eb8ef into beta Jun 9, 2025
4 checks passed
@subhankarmaiti subhankarmaiti deleted the SDK-6032-swift-build-fix branch June 9, 2025 12:28
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.

3 participants