Skip to content

Conversation

@SKannaniOS
Copy link
Contributor

@SKannaniOS SKannaniOS commented Jan 14, 2026

Description

This PR adds Objective-C compatibility to the Facebook Swift integration by introducing a wrapper class that exposes the existing FacebookIntegration to Objective-C projects. This allows Objective-C apps to seamlessly integrate Facebook App Events with RudderStack using the device mode integration.

The wrapper class ObjCFacebookIntegration (exposed as RSSFacebookIntegration in Objective-C) provides a complete interface for track, identify, and screen events while maintaining proper error handling patterns expected in Objective-C code.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactor/optimization

Implementation Details

  • Added ObjCFacebookIntegration.swift containing the Objective-C wrapper class
  • The wrapper class conforms to ObjCIntegrationPlugin and ObjCStandardIntegration protocols from RudderStackAnalytics SDK
  • Implemented all required integration methods:
    • init() - Initializes the underlying FacebookIntegration
    • getDestinationInstance() - Returns the Facebook App Events SDK instance
    • createWithDestinationConfig:error: - Creates and configures the Facebook SDK with NSError-based error handling
    • updateWithDestinationConfig:error: - Updates configuration with NSError-based error handling
    • reset() - Clears user ID and user data from Facebook App Events
    • track: - Processes track events by converting ObjCTrackEvent to TrackEvent
    • identify: - Processes identify events by converting ObjCIdentifyEvent to IdentifyEvent
    • screen: - Processes screen events by converting ObjCScreenEvent to ScreenEvent
  • Used @objc(RSSFacebookIntegration) attribute to expose the class with a user-friendly name in Objective-C
  • Updated README.md to indicate full Swift and Objective-C support

Checklist

  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation (if appropriate).
  • I have ensured that my code follows the project's code style.
  • I have checked for potential performance impacts and optimized if necessary.
  • I have checked the code for security issues.
  • I have updated the changelog (if required).

How to test?

  1. Create an Objective-C iOS project
  2. Add the RudderIntegrationFacebook package via Swift Package Manager
  3. Import the module and configure the integration:
@import RudderIntegrationFacebook;

RSSConfigurationBuilder *builder = [[RSSConfigurationBuilder alloc] initWithWriteKey:@"<WriteKey>"
                                                         dataPlaneUrl:@"<DataPlaneUrl>"];
RSSAnalytics *analytics = [[RSSAnalytics alloc] initWithConfiguration:[builder build]];

RSSFacebookIntegration *facebookIntegration = [[RSSFacebookIntegration alloc] init];
[analytics addPlugin:facebookIntegration];
  1. Verify that track, identify, and screen events are forwarded to Facebook App Events

Breaking Changes

None. This is a purely additive change that does not affect existing Swift implementations.

Maintainers Checklist

  • The code has been reviewed.
  • CI tests have passed.
  • All necessary documentation has been updated.

Screenshots (if applicable)

N/A - No UI changes

Additional Context

  • This feature enables developers working with Objective-C codebases or mixed Swift/Objective-C projects to use the Facebook integration without needing to write Swift bridging code themselves.
  • The wrapper delegates all functionality to the underlying Swift FacebookIntegration class, ensuring consistent behavior across both languages.

@SKannaniOS SKannaniOS requested a review from Copilot January 14, 2026 12:49
@SKannaniOS SKannaniOS self-assigned this Jan 14, 2026
@SKannaniOS SKannaniOS marked this pull request as ready for review January 14, 2026 12:49
@SKannaniOS SKannaniOS requested a review from a team as a code owner January 14, 2026 12:49
@SKannaniOS SKannaniOS requested review from 1abhishekpandey and ChryssaAliferi and removed request for a team January 14, 2026 12:49
@SKannaniOS SKannaniOS requested a review from vgupta98 January 14, 2026 12:49
Copy link

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 Objective-C compatibility to the Facebook Swift integration by introducing a wrapper class (ObjCFacebookIntegration) that exposes the existing Swift FacebookIntegration to Objective-C projects. The wrapper delegates all functionality to the underlying Swift implementation, ensuring consistent behavior across both languages.

Changes:

  • Added ObjCFacebookIntegration.swift with a complete Objective-C wrapper implementing ObjCIntegrationPlugin and ObjCStandardIntegration protocols
  • Updated README.md to indicate full Swift and Objective-C support

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Sources/RudderIntegrationFacebook/ObjCFacebookIntegration.swift New wrapper class that exposes FacebookIntegration to Objective-C with proper error handling, event conversion, and comprehensive documentation
README.md Added note about Swift and Objective-C support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants