Skip to content

chore: [SDK-5859] build demo-no-location with Swift Package Manager (1/3) - #2025

Open
fadi-george wants to merge 1 commit into
mainfrom
fadi/sdk-5859
Open

fadi-george wants to merge 1 commit into
mainfrom
fadi/sdk-5859

Conversation

@fadi-george

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

Copy link
Copy Markdown
Collaborator

Description

One Line Summary

Move examples/demo-no-location's iOS app from CocoaPods to React Native's Swift Package Manager mode.

Details

Motivation

CocoaPods trunk becomes read-only on Dec 2, 2026, so the SDK is dropping CocoaPods (PR 2). This demo was the last app in the repo still on pods besides demo-pods, which PR 2 deletes.

Scope

  • react-native spm add --deintegrate, same as examples/demo in chore: [SDK-5818] build the demo with Swift Package Manager (4/4) #2021: SPM packages injected into demo.xcodeproj; Podfile, Podfile.lock, workspace and Gemfile removed. RN's generated ReactNativeSPM/ and .spm-injected.json are committed since the project references them.
  • @react-native-community/cli 21.0.0 (CLI 20 only finds the iOS project through a Podfile).
  • Scripts: update:spm replaces pods/update:pods; preios runs it. ios and update:spm export ONESIGNAL_DISABLE_LOCATION=true, since SPM reads it when resolving packages.
  • The project has only the demo app target (no extension targets), so no OneSignal-XCFramework package refs were added.
  • .prettierignore skips the generated .spm-injected.json.

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

Stack

  1. chore: [SDK-5859] build demo-no-location with Swift Package Manager (1/3) #2025 Build demo-no-location with Swift Package Manager (this PR)
  2. feat!: [SDK-5859] drop CocoaPods support, require React Native 0.87+ (2/3) #2026 Drop CocoaPods support, require React Native 0.87+
  3. docs: [SDK-5859] document SPM-only iOS setup (3/3) #2027 Document SPM-only iOS setup

Testing

Unit testing

No new tests. vp test passes.

Manual testing

vp run update:spm and a Debug simulator build from demo.xcodeproj pass. The app links the OneSignal frameworks without OneSignalLocation.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@abdulraqeeb33 abdulraqeeb33 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.

Requesting changes. vp run ios fails on a machine that already has this example.

examples/setup.sh:46 skips reinstall when the SDK tarball hash matches. This PR leaves that tarball alone and moves the example CLI from 20.2.0 to 21.0.0 (examples/demo-no-location/package.json:25). CLI 20's project loader returns null when ios/ has no Podfile. react-native spm still runs, because React Native 0.88 registers it. run-ios then has no iOS project. Put the example package.json and bun.lock in the stamp, hashed from $DEMO_DIR:

deps_hash=$(shasum "$DEMO_DIR/package.json" "$DEMO_DIR/bun.lock" | shasum | awk '{print $1}')
stamp_value="${tarball_hash}-${deps_hash}"

Compare that to the stamp, and write it after install.

A checkout that has opened the old workspace still has ios/demo.xcworkspace after this pull. .gitignore:45 keeps xcuserdata, so git removes contents.xcworkspacedata and leaves the directory. CLI 21 sorts ios/ and picks .xcworkspace over .xcodeproj, then reads the missing contents file. clean:ios only deletes ios/build (package.json:13). Drop the workspace on the way in:

"preios": "vp run setup && rm -rf ios/Pods ios/demo.xcworkspace && vp run update:spm",
"clean:ios": "rm -rf ios/build ios/Pods ios/demo.xcworkspace"

vp run ios does export ONESIGNAL_DISABLE_LOCATION into run-ios, and that is the process that loads Package.swift. spm update does not evaluate this manifest, so the prefix on update:spm (package.json:11) does not drop OneSignalLocation. README line 29 should say the variable has to be set for Xcode or xcodebuild. Launch Xcode from a terminal that exports it, then reset package caches. The root README already says that.

.github/workflows/ios-spm.yml builds examples/demo only. Nothing here links this app or checks that OneSignalLocation is absent. A job on this stack would lock it. I would not hold the script fixes on that.

project.pbxproj:467 still points REACT_NATIVE_PATH at ${PODS_ROOT}. The target xcconfig overrides it. examples/demo rewrote the project-level value. README.md:48 says App.tsx does not call OneSignal.Location. App.tsx:62 does.

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