-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(iOS): RN-77 Swift support (#8037) #8043
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
Conversation
gosha212
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Swift support for RN-77 by creating a modulemap for ReactNativeNavigation and extending the rnn-link script to detect and update Swift AppDelegate files.
- Generates a modulemap during
pod installso Swift users canimport ReactNativeNavigation. - Enhances
rnn-linkto detectAppDelegate.swift, insert the correct import, and change the base class. - Updates
ReactNativeNavigation.podspecto expose the new public header and enable module definition.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| autolink/postlink/path.js | Imported new log helpers and added logic to locate AppDelegate.swift |
| autolink/postlink/appDelegateLinker.js | Added Swift flow to modify AppDelegate.swift imports and base class |
| ReactNativeNavigation.podspec | Added RNNAppDelegate.h to public headers and set DEFINES_MODULE |
Comments suppressed due to low confidence (5)
autolink/postlink/path.js:5
- [nitpick] The imported logging function names
warnn,infon, anddebugnuse a non-standard suffix. Consider renaming them towarn,info, anddebugfor clarity and consistency.
var { warnn, infon, debugn } = require('./log');
ReactNativeNavigation.podspec:34
- Consider specifying
s.swift_version(for example,s.swift_version = '5.0') in the podspec to ensure proper Swift compatibility when integrating this library.
"DEFINES_MODULE" => "YES"
autolink/postlink/appDelegateLinker.js:26
debugnis called here but not imported or defined in this file, which will cause a runtime error. Ensure thatdebugnis imported from the logging module or otherwise defined.
debugn('Entering Swift flow ...');
autolink/postlink/appDelegateLinker.js:30
- [nitpick] This assignment is missing a semicolon at the end. For consistency with the project's JavaScript style, consider adding a semicolon.
this.removeUnneededImportsSuccess = true
autolink/postlink/appDelegateLinker.js:31
- [nitpick] This assignment is missing a semicolon at the end. For consistency with the project's JavaScript style, consider adding a semicolon.
this.removeApplicationLaunchContentSuccess = true
* Test were updated to remove older versions of RN.
gosha212
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
Added Swift support for RN77.
When running pod install, a modulemap for the ReactNativeNavigation is now created with the ReactNativeNavigation-umbrella.h file. This will allow easy linking in Swift by just adding the following to the AppDelegate.swift file:
import ReactNativeNavigationAlso the 'rnn-link' script will now detect if we are dealing with an Objc or Swift project and automatically update the Swift file with the following changes:
import ReactNativeNavigationis addedclass AppDelegate: RCTAppDelegateis converted toclass AppDelegate: RNNAppDelegate.