Skip to content

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

Merged
merged 4 commits into from
Jun 10, 2025
Merged

Conversation

markdevocht
Copy link
Contributor

@markdevocht markdevocht commented Jun 9, 2025

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 ReactNativeNavigation

Also 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 ReactNativeNavigation is added
class AppDelegate: RCTAppDelegate is converted to class AppDelegate: RNNAppDelegate.

@markdevocht markdevocht requested a review from gosha212 June 9, 2025 12:33
@markdevocht markdevocht self-assigned this Jun 9, 2025
@gosha212
Copy link
Contributor

gosha212 commented Jun 9, 2025

Fixes #8037.
Implement iOS part of rnn-link #7943

Copy link
Contributor

@gosha212 gosha212 left a 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

@gosha212 gosha212 requested a review from Copilot June 9, 2025 21:13
Copy link

@Copilot Copilot AI left a 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 install so Swift users can import ReactNativeNavigation.
  • Enhances rnn-link to detect AppDelegate.swift, insert the correct import, and change the base class.
  • Updates ReactNativeNavigation.podspec to 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, and debugn use a non-standard suffix. Consider renaming them to warn, info, and debug for 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

  • debugn is called here but not imported or defined in this file, which will cause a runtime error. Ensure that debugn is 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.
@markdevocht markdevocht changed the title feat(iOS): RN-77 Swift support feat(iOS): RN-77 Swift support (#8037) Jun 10, 2025
gosha212
gosha212 previously approved these changes Jun 10, 2025
Copy link
Contributor

@gosha212 gosha212 left a comment

Choose a reason for hiding this comment

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

Amazing!

@gosha212 gosha212 marked this pull request as ready for review June 10, 2025 10:12
@gosha212 gosha212 merged commit ad65cf9 into master Jun 10, 2025
4 checks passed
@gosha212 gosha212 deleted the feat/rn77-swift-support branch June 10, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants