Skip to content

Add Swift code snippets to Fabric native component iOS documentation#4936

Open
AbhishekGiri04 wants to merge 3 commits into
react:mainfrom
AbhishekGiri04:add-swift-fabric-native-components
Open

Add Swift code snippets to Fabric native component iOS documentation#4936
AbhishekGiri04 wants to merge 3 commits into
react:mainfrom
AbhishekGiri04:add-swift-fabric-native-components

Conversation

@AbhishekGiri04

Copy link
Copy Markdown
Contributor

Summary

This PR adds Swift code examples to the Fabric native component iOS documentation, providing Swift developers with clear implementation examples alongside existing Objective-C code.

Motivation

Fixes #4897

The current documentation only shows Objective-C examples for iOS Fabric native components, while Android documentation provides both Java and Kotlin options. This creates a gap for Swift developers who may not be familiar with Objective-C syntax.

Changes

  • Added tabbed code examples (Objective-C/Swift) to docs/fabric-native-components-ios.md
  • Implemented complete Swift version of RCTWebView class with modern Swift patterns
  • Maintains consistency with Android documentation structure (Java/Kotlin tabs)
  • Includes proper Swift syntax for:
    • Class declarations with @objc annotations
    • Property initialization and management
    • Protocol conformance using extensions
    • Event emitter handling

Test Plan

  • Verified code examples follow Swift best practices
  • Ensured consistency with existing documentation structure
  • Confirmed tab functionality matches Android documentation pattern
Fixes react#3679

Added a note clarifying that the standalone systrace tool has been
removed from Android platform-tools and users should use Android
Studio Profiler instead. This addresses confusion around the
deprecated systrace command-line tool while maintaining the
documentation for the Systrace API in React Native.

Changes:
- Added deprecation notice for standalone systrace tool
- Clarified that Android Studio Profiler is the recommended alternative
- Improved documentation clarity for developers migrating from systrace
- Added tabbed code examples (Objective-C/Swift) for iOS Fabric components
- Implemented complete Swift version of RCTWebView class
- Maintains consistency with Android documentation structure (Java/Kotlin tabs)
- Fixes react#4897
@meta-cla meta-cla Bot added the CLA Signed label Dec 27, 2025
@netlify

netlify Bot commented Dec 27, 2025

Copy link
Copy Markdown

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit bacf367
🔍 Latest deploy log https://app.netlify.com/projects/react-native/deploys/69501b47a54b25000849f6d5
😎 Deploy Preview https://deploy-preview-4936--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@divyanshu-patil

Copy link
Copy Markdown

hey, thanks for addressing the issue, this is core problem i face
also i request maintainers to add more examples and not to limit the examples to only webview

@AbhishekGiri04

Copy link
Copy Markdown
Contributor Author

Thanks @divyanshu-patil! I kept this PR focused on fixing #4897 by adding Swift equivalents to existing examples.

For additional examples beyond WebView, I'd suggest opening a separate issue to discuss with maintainers which components would be most valuable.

@facebook/react-native-team - Ready for review.

@Simek Simek requested a review from cipolleschi December 30, 2025 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants