Skip to content

[SDK-873] iOS: link the NSE's IterableAppExtensions through SPM - #78

Open
joaodordio wants to merge 4 commits into
mainfrom
cursor/nse-spm-ad5a
Open

joaodordio wants to merge 4 commits into
mainfrom
cursor/nse-spm-ad5a

Conversation

@joaodordio

@joaodordio joaodordio commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Note

Version context (as of 2026-12-02):

  • @iterable/react-native-sdk 4.0.0 is published and still installs the iOS SDK through the Iterable-iOS-SDK 6.7.5 pod.
  • 4.1.0 moves the RN SDK to SPM and Xcode 26 (react-native-sdk#947).
  • The newest published plugin is @iterable/expo-plugin 1.1.0, with peer @iterable/react-native-sdk: ^3.0.0. Expo apps installing RN SDK 4.0.0 therefore hit an npm peer conflict today.

This PR builds against the pod-based RN SDK (3.x, 4.0.x) and the SPM-based one (4.1.0 and later). Its peer range ^3.0.0 || ^4.0.0 covers both, so it can ship before RN 4.1.0, and has to ship no later than it.

📝 Summary

iOS: link IterableAppExtensions to the IterableExpoRichPush NSE through SPM instead of the frozen CocoaPods pod, and build with both the pod-based and the SPM-based RN SDK.

🎟️ Jira Ticket: SDK-873

📖 Description

CocoaPods trunk went read-only on 2026-12-02, so Iterable-iOS-AppExtensions 6.7.5 is the last version that will ever be published there.

  • NSE via SPM. The existing withXcodeProject mod now adds an XCRemoteSwiftPackageReference for https://github.com/Iterable/iterable-swift-sdk.git (up to next major from 6.7.5). It also adds an IterableAppExtensions product dependency and a Frameworks build file on IterableExpoRichPush. This runs for new targets, and idempotently for targets that already exist (expo prebuild without --clean). The range always admits the exact version the RN SDK pins (today 6.7.5, through the pod or through SPM), so the workspace resolves one version.
  • Podfile. The plugin no longer injects target 'IterableExpoRichPush' do pod 'Iterable-iOS-AppExtensions' end, and it removes that block if an earlier plugin version left it there. Otherwise the NSE would get two IterableAppExtensions modules. Only a block that contains the Iterable pod is removed, matched on the column-0 end the old plugin wrote.
  • ExpoAdapterIterable.podspec. Adds the same SWIFT_INCLUDE_PATHS entry RN's spm.rb adds to the declaring pod. With the SPM-based RN SDK, IterableAppDelegate.swift otherwise fails with no such module 'IterableSDK' (reproduced). It's a search path only, not a link, so there's no second SDK copy. It has no effect with the pod-based RN SDK (3.x and 4.0.x).
  • Peer range widened from ^3.0.0 to ^3.0.0 || ^4.0.0. This fixes the peer conflict for RN SDK 4.0.0, which is live today, and covers 4.1.0, the SPM cutover.
  • README and CHANGELOG updated. yarn.lock changes only in the peer line.

Overlap: #65 (NotificationDelegateRouter) adds Swift files to ExpoAdapterIterable. The podspec include path covers them, and there are no file conflicts.

🧪 How to test?

Run yarn test. Then in example/, run npx expo prebuild --platform ios --clean && cd ios && pod install, and build. IterableExpoRichPush should list IterableAppExtensions under Frameworks, and the Podfile should have no NSE target.

Verified locally on Xcode 27.2 with Expo 55 / RN 0.83.2:

RN SDK Linkage Result
#947 branch (SPM, ships in 4.1.0) static libraries builds and runs; the NSE .appex links ITBNotificationServiceExtension; one iterable-swift-sdk 6.7.5 is resolved for the workspace
#947 branch (SPM) use_frameworks! static builds
#947 branch (SPM) use_frameworks! dynamic builds and runs; IterableSDK classes are defined once (in the RN framework)
#947 branch (SPM), Release static libraries builds and runs
3.2.1 (trunk pod 6.7.5) static libraries builds (app on the pod, NSE on SPM)

The published 4.0.0 has the same iOS dependency as 3.2.1 (the Iterable-iOS-SDK 6.7.5 pod), but I did not build it separately.

Also verified: a non-clean expo prebuild over a Podfile that still has the legacy block strips it and leaves exactly one package reference and one Frameworks entry.

CI on head 0b5c1a0 (README and CHANGELOG change only since 3f1f1693): every check passes except CodeQL Swift, which was still running when this was written. It passed on 3f1f1693. CodeQL Swift (Xcode 26.3) runs expo prebuild --clean with RN SDK 3.2.1, resolves iterable-swift-sdk 6.7.5 for the NSE, and builds the example. yarn test:coverage (11 suites, 78 tests, new code at 100% lines), yarn tsc --noEmit, yarn prepare and yarn lint all pass. The new withIosPushNotifications.utils.test.ts uses the real xcode parser and writer, including a write-and-reparse round trip and an idempotency check.

Not verified: rich push actually rendering through the NSE. The simulator can't authorize notifications without UI automation, so that needs a pass on a device.

🧾 Changelog

Added under [Unreleased].

📹 Loom recording if applicable

N/A

🐞 Github Issues solved

N/A

📚 Docs PR if applicable

iterable-docs#1659 (replaces #1658) covers the Expo page. It says the NSE is linked through SPM, and that RN SDK 4.1.0 and later need this plugin release (the first version after 1.1.x) and Xcode 26+.

CocoaPods trunk is read-only, so Iterable-iOS-AppExtensions 6.7.5 is the last
version published there. The plugin now adds the iterable-swift-sdk package to
the IterableExpoRichPush target instead of injecting the pod, and removes the
Podfile target that earlier versions added. ExpoAdapterIterable searches the
SPM products directory so it builds when @iterable/react-native-sdk pulls
IterableSDK through spm_dependency. Widens the RN SDK peer to ^3.0.0 || ^4.0.0.
Anchor the Podfile match on the column-0 end the old plugin wrote so empty or
nested blocks are handled, normalize package URLs before reuse, and clarify
the existing-target log message.
@joaodordio
joaodordio requested a review from a team as a code owner December 2, 2026 11:42
@qltysh

qltysh Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (3)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...rc/withPushNotifications/withIosPushNotifications.constants.ts100.0%
Coverage rating: A Coverage rating: A
...in/src/withPushNotifications/withIosPushNotifications.utils.ts100.0%
Coverage rating: A Coverage rating: A
plugin/src/withPushNotifications/withIosPushNotifications.ts100.0%
Total100.0%
Commit 0b5c1a0 · 🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

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.

1 participant