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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions A0Auth0.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Pod::Spec.new do |s|
s.license = package['license']
s.authors = package['author']
s.platforms = { :ios => min_ios_version_supported }
s.swift_version = '5.0'
s.source = { :git => 'https://github.com/auth0/react-native-auth0.git', :tag => "v#{s.version}" }

s.source_files = 'ios/**/*.{h,m,mm,swift}'
Expand Down
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,32 @@ _Note_ : We have platform agnostic error codes available only for `CredentialsMa
| `NO_NETWORK` | `NO_NETWORK` | |
| `API_ERROR` | `API_ERROR` | |

## Troubleshooting

### Swift 6 Compatibility Issues on iOS

If your main application project is configured to use Swift 6, and you encounter build errors related to Swift version incompatibilities with `react-native-auth0` or its dependencies (like `Auth0.swift`, `JWTDecode`, `SimpleKeychain`), you can ensure these specific pods are compiled with Swift 5.

While `react-native-auth0` (from v5.0.0-beta.1 onwards) and its direct Swift dependencies are configured to use Swift 5, your project's build settings might try to override this. To enforce Swift 5 for these pods:

**Recommended: Podfile `post_install` Hook**

Add the following `post_install` hook to your application's `ios/Podfile`. This is generally the most robust way to manage build settings for dependencies:

```ruby
# In your application's ios/Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
# Target the react-native-auth0 pod and its Swift dependencies
if ['Auth0', 'A0Auth0', 'JWTDecode', 'SimpleKeychain'].include?(target.name)
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '5.0'
end
end
end
end
```

## Feedback

### Contributing
Expand Down