You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dda80a2
Browse filesBrowse the repository at this point in the historyBrowse files
Warn instead of refusing --deintegrate with other pods
The Podfile is moved to Podfile.bak, so no pod is lost and `spm deinit`
restores it. An explicit `--deintegrate` now lists the other pods, says
CocoaPods will not install them while the app uses SwiftPM unless SwiftPM
provides them, and continues. RNTester needs this: its Podfile has local
example pods that SwiftPM provides.
The automatic conversion of a new app still skips such Podfiles.
Copy file name to clipboardExpand all lines: packages/react-native/scripts/spm/__docs__/spm-scripts.md
+11-6Lines changed: 11 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ The zero-arg conversion of a fresh app does the same steps. It does not start
52
52
when `Podfile.bak` exists; the command then fails as a plain `add` does.
53
53
54
54
If the Podfile declares pods that are not part of React Native, `--deintegrate`
55
-
refuses and changes nothing. Those pods would stop working under SwiftPM. See
55
+
converts the app anyway and names those pods in a warning. See
56
56
[Keeping non-RN pods](#keeping-non-rn-pods).
57
57
58
58
After the conversion, the app has no Podfile. The CLI then finds the iOS project
@@ -62,8 +62,13 @@ the iOS project.
62
62
63
63
### Keeping non-RN pods
64
64
65
-
`--deintegrate` does not convert an app whose Podfile has pods that are not part
66
-
of React Native. To keep those pods side-by-side, convert by hand:
65
+
`--deintegrate` converts an app whose Podfile has pods that are not part of
66
+
React Native, and warns. While the app uses SwiftPM, CocoaPods does not install
67
+
those pods, unless SwiftPM provides them as an autolinked library or a
68
+
[local native module](#local-native-modules). The pods stay in `Podfile.bak`,
69
+
and `spm deinit` restores the Podfile.
70
+
71
+
To keep a CocoaPods-only pod next to SwiftPM, convert by hand:
67
72
68
73
```bash
69
74
pod deintegrate # removes the CocoaPods integration from the .xcodeproj
@@ -140,7 +145,7 @@ Flags below use the `react-native spm` (camelCase) form.
140
145
|`--yes`| Skip the dirty-pbxproj confirmation prompt |
141
146
|`--xcodeproj <path>`|[add, update, scaffold, deinit] Which `.xcodeproj` to inject into or remove from (when several exist) |
142
147
|`--productName <name>`|[add, update, scaffold] Which app target to inject into (when several exist) |
143
-
|`--deintegrate`|[add] Run `pod deintegrate` and move the Podfile to `Podfile.bak` before injecting. Refused if the Podfile has pods that are not part of React Native|
148
+
|`--deintegrate`|[add] Run `pod deintegrate` and move the Podfile to `Podfile.bak` before injecting. Warns about pods that are not part of React Native; see [Keeping non-RN pods](#keeping-non-rn-pods)|
144
149
|`--artifacts <path>`|[advanced] Local artifact root containing complete `debug/` and `release/` cache slots |
|`--skipCodegen`|[advanced] Skip the codegen step |
@@ -302,7 +307,7 @@ Paths are relative to the Xcode project directory (`ios/`) unless noted.
302
307
|`ReactNativeSPM/Scripts/`|`add`, `update`, `scaffold`| Regenerated on each run and written when their content changes: `sync-autolinking.sh` and `embed-flavored-frameworks.sh`, the scripts the Sync and embed phases run. Plugin script phases keep their scripts in `project.pbxproj`. **Commit it.** When a script is missing, its phase fails the build with `error: <path> is missing. Run 'npx react-native spm update' to generate it.`| Yes — both scripts are deleted, then each `ReactNativeSPM/` directory left empty |
303
308
|`MyApp.xcodeproj/xcshareddata/xcschemes/*.xcscheme`|`add`, `update`, `scaffold`| The sync pre-action is added to the scheme that builds your target; a shared scheme is created if there is none. Commit this or teammates lose the pre-action. | Yes — a scheme `add` created is deleted only if it is still byte-identical to the generated one; otherwise only the pre-action is stripped |
304
309
|`.gitignore`|`add` only | Created if absent, else appended: a `# SPM – auto-generated at build time` block adding `Package.resolved`, `build/generated/`, `build/xcframeworks/`, `.build/`. | Yes — only the lines `add` wrote, as recorded in the marker, and the file too if `add` created it and nothing else is left. A line you changed is kept, and `deinit` says so. A marker from an older version has no record, so `.gitignore` is left as it is |
305
-
|`Podfile`|`add --deintegrate`| Moved to `Podfile.bak`, unchanged. Refused, before any change, if the Podfile has pods that are not part of React Native or `Podfile.bak` already exists.| Yes — `Podfile.bak` is moved back to `Podfile`. If both files exist, `deinit` stops before it changes anything |
310
+
|`Podfile`|`add --deintegrate`| Moved to `Podfile.bak`, unchanged. Refused, before any change, if `Podfile.bak` already exists. | Yes — `Podfile.bak` is moved back to `Podfile`. If both files exist, `deinit` stops before it changes anything |
306
311
|`Pods/`, `Pods-*.xcconfig`, `[CP]` phases |`add --deintegrate`| Removed by `pod deintegrate`. The `.xcworkspace` referencing them is left on disk. |**No** — run `pod install` to restore |
307
312
308
313
The two pins are the `--version` pin (`artifactsVersionOverride`, see
@@ -730,7 +735,7 @@ across apps; refresh it with `react-native spm update --download force`.
|`xcodebuild` fails: "Could not resolve package dependencies … `build/generated/autolinking` doesn't exist" | Fresh clone — run `npx react-native spm` once before building (see [Fresh clones & CI](#fresh-clones--ci)) |
732
737
| Build fails: `error: …/ReactNativeSPM/Scripts/<name>.sh is missing`|`ReactNativeSPM/` was not committed. Run `npx react-native spm update`, then commit `ReactNativeSPM/`|
733
-
|`spm add` fails: "CocoaPods-integrated project" | Re-run `spm add --deintegrate` (runs `pod deintegrate` and moves the Podfile to `Podfile.bak`). If the Podfile has pods that are not part of React Native, convert by hand (see [Keeping non-RN pods](#keeping-non-rn-pods)).|
738
+
|`spm add` fails: "CocoaPods-integrated project" | Re-run `spm add --deintegrate` (runs `pod deintegrate` and moves the Podfile to `Podfile.bak`). Pods that are not part of React Native are not installed while the app uses SwiftPM (see [Keeping non-RN pods](#keeping-non-rn-pods)). |
734
739
|`spm add` fails: "no .xcodeproj found" | Create an app first (`npx @react-native-community/cli init`) or make a project in Xcode, then `spm add`. |
|`Package.swift is missing for library "<name>"` (exit 2) | The dep ships no SwiftPM support. `npx react-native spm scaffold`, then re-run setup; persist with `patch-package`. See [Community packages without a Package.swift](#community-packages-without-a-packageswift)|
0 commit comments