Skip to content

Commit 73eb8ef

Browse files
Ensure Swift 5 compilation for SDK pods to improve Swift 6 compatibility (#1203)
1 parent d62d1f4 commit 73eb8ef

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

A0Auth0.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Pod::Spec.new do |s|
1111
s.license = package['license']
1212
s.authors = package['author']
1313
s.platforms = { :ios => min_ios_version_supported }
14+
s.swift_version = '5.0'
1415
s.source = { :git => 'https://github.com/auth0/react-native-auth0.git', :tag => "v#{s.version}" }
1516

1617
s.source_files = 'ios/**/*.{h,m,mm,swift}'

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,32 @@ _Note_ : We have platform agnostic error codes available only for `CredentialsMa
664664
| `NO_NETWORK` | `NO_NETWORK` | |
665665
| `API_ERROR` | `API_ERROR` | |
666666

667+
## Troubleshooting
668+
669+
### Swift 6 Compatibility Issues on iOS
670+
671+
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.
672+
673+
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:
674+
675+
**Recommended: Podfile `post_install` Hook**
676+
677+
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:
678+
679+
```ruby
680+
# In your application's ios/Podfile
681+
post_install do |installer|
682+
installer.pods_project.targets.each do |target|
683+
# Target the react-native-auth0 pod and its Swift dependencies
684+
if ['Auth0', 'A0Auth0', 'JWTDecode', 'SimpleKeychain'].include?(target.name)
685+
target.build_configurations.each do |config|
686+
config.build_settings['SWIFT_VERSION'] = '5.0'
687+
end
688+
end
689+
end
690+
end
691+
```
692+
667693
## Feedback
668694

669695
### Contributing

0 commit comments

Comments
 (0)