Skip to content

Fix IterableDataRegion by adding @objc annotation and creating Object… #913

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 6 commits into from
May 30, 2025

Conversation

sumeruchat
Copy link
Contributor

@sumeruchat sumeruchat commented May 13, 2025

…ive-C test

🔹 Jira Ticket(s)

✏️ Description

Fixed an issue where IterableDataRegion couldn't be accessed from Objective-C code because it was missing the required @objc annotation. This caused compilation errors in Objective-C projects trying to use the data region constants with the SDK.

Changes made:

  1. Added @objc annotation to IterableDataRegion enum to expose it to Objective-C
  2. Created an Objective-C test to verify the fix works correctly
  3. Ensures the SDK's documented Objective-C code examples can now compile properly
  4. The issue was identified in our documentation where Objective-C sample code using IterableDataRegion would not compile.

Copy link

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.05%. Comparing base (6e2fdec) to head (d7da751).
Report is 862 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #913       +/-   ##
===========================================
- Coverage   85.19%   69.05%   -16.15%     
===========================================
  Files          91      104       +13     
  Lines        6301     7522     +1221     
===========================================
- Hits         5368     5194      -174     
- Misses        933     2328     +1395     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Ayyanchira Ayyanchira self-requested a review May 13, 2025 18:00
Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +306 to +308
@objc public class IterableDataRegion: NSObject {
@objc public static let US = "https://api.iterable.com/api/"
@objc public static let EU = "https://api.eu.iterable.com/api/"
Copy link
Member

Choose a reason for hiding this comment

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

No native enum support in objc was indeed a new learning for me!

Copy link
Member

Choose a reason for hiding this comment

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

2 things to monitor will be :

  1. Devs using this enum for EU.
  2. RN layer or other platforms relying on native SDK getting affected.

@joaodordio joaodordio requested a review from Copilot May 30, 2025 13:59
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 fixes an Objective-C compatibility issue by converting IterableDataRegion from a Swift enum to an @objc class and adds the necessary test and project configuration updates. Key changes include:

  • Adding the @objc annotation and converting IterableDataRegion to a class.
  • Including an Objective-C unit test (IterableDataRegionObjCTests.m) to verify the fix.
  • Updating the project file and bridging header configuration to support the Objective-C integration.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/unit-tests/unit-tests-Bridging-Header.h Added a bridging header to expose target public headers to Swift.
tests/unit-tests/IterableDataRegionObjCTests.m Added an Objective-C test to ensure IterableDataRegion is accessible from Obj-C.
swift-sdk/Core/Constants.swift Converted IterableDataRegion from an enum to an @objc class for Obj-C compatibility.
swift-sdk.xcodeproj/project.pbxproj Updated project configuration to include new test files and proper bridging settings.

@joaodordio
Copy link
Member

LGTM!

Copy link
Member

@joaodordio joaodordio left a comment

Choose a reason for hiding this comment

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

LGTM

@Ayyanchira Ayyanchira merged commit 717b28c into master May 30, 2025
4 of 5 checks passed
@Ayyanchira Ayyanchira deleted the feature/MOB-11417-fix-iterable-data-region branch May 30, 2025 18:01
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