Skip to content

feat: [SDK-5818] add Package.swift for React Native SPM mode (1/4) - #2018

Merged
fadi-george merged 2 commits into
mainfrom
fadi-sdk-5818
Nov 21, 2026
Merged

fadi-george merged 2 commits into
mainfrom
fadi-sdk-5818

Conversation

@fadi-george

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

Copy link
Copy Markdown
Collaborator

Description

One Line Summary

Ship a Package.swift so apps using React Native's Swift Package Manager mode can link the SDK and OneSignal-XCFramework.

Details

Motivation

CocoaPods trunk goes read-only on Dec 2, and RN 0.89 plans to make SPM the default. Without a manifest, npx react-native spm add fails with Package.swift is missing for library "react-native-onesignal", and RN's spm scaffold can't generate the OneSignal-XCFramework dependency. Fixes #2016.

Scope

  • One ObjC/ObjC++ target over ios/RCTOneSignal, depending on RN's generated header packages and OneSignalFramework + OneSignalInAppMessages (+ OneSignalLocation unless ONESIGNAL_DISABLE_LOCATION is set, matching the podspec, Capacitor, and Flutter).
  • OneSignal-XCFramework pinned exact to the podspec version; the release workflow now bumps both.
  • swiftpmConfig.name in package.json, and Package.swift added to files.
  • README section on SPM and the location flag.
  • CocoaPods integration is unchanged.

Stack

  1. feat: [SDK-5818] add Package.swift for React Native SPM mode (1/4) #2018 Package.swift (this PR)
  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

Testing

Unit testing

__tests__/packageSwift.test.ts fails if the XCFramework pin drifts from the podspec or swiftpmConfig.name doesn't match the product. CI doesn't build the manifest otherwise; PR 4 adds a build job.

Manual testing

Fresh RN 0.88.1 app with the SDK installed from an npm pack tarball: spm add --deintegrate picked up the package; Debug, Release, and ONESIGNAL_DISABLE_LOCATION=true builds succeeded (no OneSignalLocation.framework in the last). Runtime tested through the SPM demo in PR 4 on an iOS 27 simulator: fresh install, user and push subscription created, login round-trip.

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

Ship a Swift package manifest so apps using React Native's Swift Package
Manager mode can link the SDK and OneSignal-XCFramework. Location is
omitted when ONESIGNAL_DISABLE_LOCATION is set, matching the podspec.
The release workflow bumps the XCFramework pin in both files, and a test
keeps them in sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread README.md Resolved
…on CI note

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadi-george
fadi-george merged commit 64c7def into main Nov 21, 2026
2 of 3 checks passed
@fadi-george
fadi-george deleted the fadi-sdk-5818 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.

[Question]: Swift Package Manager support (Package.swift)

2 participants