Skip to content

chore: [SDK-5818] build the demo with Swift Package Manager (4/4) - #2021

Merged
fadi-george merged 3 commits into
fadi-sdk-5818-demo-podsfrom
fadi-sdk-5818-demo-spm
Nov 21, 2026
Merged

fadi-george merged 3 commits into
fadi-sdk-5818-demo-podsfrom
fadi-sdk-5818-demo-spm

Conversation

@fadi-george

@fadi-george fadi-george commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

One Line Summary

Move examples/demo's iOS app to React Native's Swift Package Manager mode and build it in CI and E2E.

Details

Motivation

The SDK's Package.swift (PR 1) needs a reference app and a CI build; nothing else compiles it. demo-pods (PR 3) keeps the CocoaPods build.

Scope

  • react-native spm add --deintegrate: SPM packages injected into demo.xcodeproj, CocoaPods removed (Podfile, Podfile.lock, workspace, Gemfile). RN's generated ReactNativeSPM/ folder and .spm-injected.json are committed since the project references them.
  • @react-native-community/cli 21.0.0 in demo and demo-pods (kept in sync by the demo sync test). CLI 20 only finds the iOS project through a Podfile; 21 detects SPM projects by .spm-injected.json (feat: detect Swift Package Manager projects react-native-community/cli#2858), so the demo has no Podfile.
  • Extension targets link OneSignal-XCFramework directly: NSE → OneSignalExtension, widget → OneSignalFramework (for OneSignalLiveActivities). Range >= 5.0.0 < 6, so the SDK's exact pin decides the version. spm update keeps these.
  • react-native-screens, @react-native-async-storage/async-storage, and react-native-vector-icons ship no Package.swift, so patches/ adds scaffolded ones (react-native spm scaffold, applied by Bun). Hand fixes on top of the scaffold output:
    • vector-icons: dropped the invalid resources: [.copy("Fonts/*.ttf")]; the two fonts the app uses are added to the app target so UIAppFonts keeps working.
    • async-storage: target renamed so SwiftPM doesn't treat ios/RNCAsyncStorage.h as an umbrella header and reject the .xcodeproj beside it.
    • screens: added the common/cpp/react/renderer/components header search path for rnscreens/... imports.
  • Scripts: update:spm replaces update:pods; preios runs it.
  • New ios-spm.yml workflow: Debug simulator build of the demo on PRs touching Package.swift, ios/, package.json, or examples/demo/.
  • iOS E2E builds the SPM demo: update:spm instead of pod update, archive from demo.xcodeproj, DerivedData cache keyed on bun.lock and the pbxproj and restored before generation (it shares ios/build).
  • Release workflow only refreshes demo-pods' Podfile and lockfile.
  • .prettierignore skips RN's generated .spm-injected.json.

Most of the diff is generated (pbxproj, scheme pre-action, RN's SPM scripts, patches).

Stack

  1. feat: [SDK-5818] add Package.swift for React Native SPM mode (1/4) #2018 Package.swift
  2. chore: [SDK-5818] upgrade demos to React Native 0.88.1 (2/4) #2019 Upgrade demos to RN 0.88.1
  3. chore: [SDK-5818] add CocoaPods demo-pods app (3/4) #2020 Add CocoaPods demo-pods app
  4. chore: [SDK-5818] build the demo with Swift Package Manager (4/4) #2021 Build the demo with Swift Package Manager (this PR)

Testing

Manual testing

On an iOS 27 simulator, fresh install of the Release build: SDK created a user and push subscription, permission prompt, login with an external ID round-tripped, and MaterialIcons glyphs render. Both extensions resolve OneSignal frameworks through @executable_path/../../Frameworks. Debug build also passes from a clean ios/build after vp run preios. After the CLI 21 bump: react-native config reports buildSystem: "spm" with no Podfile, spm update and a Debug simulator build pass, and demo-pods still resolves the same pods. E2E's Release iphoneos archive from demo.xcodeproj succeeds locally unsigned, with both extensions, the OneSignal frameworks, and main.jsbundle; the signed E2E run happens on the next rel/** push or a manual dispatch.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

🤖 Generated with Claude Code

@sherwinski sherwinski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: after this PR it appears that no CI job builds the CocoaPods integration. Just flagging that in case it's unintentional, or I missed something.

fadi-george and others added 3 commits November 20, 2026 18:07
Move examples/demo's iOS app to React Native's SwiftPM mode so the SDK's
Package.swift has a reference app; demo-pods keeps the CocoaPods build.
The extension targets link OneSignal-XCFramework products directly.
react-native-screens, async-storage, and vector-icons ship no manifest
yet, so patches add scaffolded ones with fixes for SwiftPM's header and
resource rules. A path-filtered workflow builds the demo on PRs that
touch the SDK's iOS code or the demo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@react-native-community/cli 21 detects SPM projects by the .spm-injected.json
marker, so the demo no longer needs a Podfile for the CLI to find its iOS project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george force-pushed the fadi-sdk-5818-demo-spm branch from 4d2f016 to b6adad4 Compare November 21, 2026 02:07
@fadi-george
fadi-george merged commit 592e78c into main Nov 21, 2026
4 of 6 checks passed
@fadi-george
fadi-george deleted the fadi-sdk-5818-demo-spm branch November 21, 2026 02:28
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.

2 participants