Skip to content

Conversation

@AbhishekGiri04
Copy link
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 facebook#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 facebook#4897
@meta-cla meta-cla bot added the CLA Signed label Dec 27, 2025
@netlify
Copy link

netlify bot commented Dec 27, 2025

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

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
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.

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.

add the swift code snippet in the fabric native component section

2 participants