Repository navigation
feat(ios): add Swift Package Manager support - #1187
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Fix the incompatible Swift bridge and enforce the SwiftPM CI job before approval.
2 open findings
What changed in this PR
Adds Swift Package Manager support for the iOS pager view while preserving CocoaPods integration.
Changes:
- Adds SwiftPM manifest and package metadata.
- Introduces Objective-C/Swift bridging updates.
- Adds SwiftPM CI workflow support.
| File | Summary | Findings |
|---|---|---|
react-native-pager-view.podspec |
Excludes the SwiftPM manifest from CocoaPods sources. | None |
package.json |
Adds SwiftPM metadata. | Nit (1 vote): document SwiftPM installation and the CocoaPods/SwiftPM choice. |
ios/RNCPagerViewProviding.h |
Defines the native provider bridge API. | None |
ios/RNCPagerViewComponentView.mm |
Uses the provider bridge. | None |
ios/PagerViewProvider.swift |
Implements the Swift provider bridge. | Critical (1 vote): the @_cdecl signature is not C-compatible and will fail compilation. |
ios/PagerViewProps.swift |
Imports shared SwiftPM enum definitions. | None |
ios/PagerView.swift |
Adds SwiftPM imports. | None |
ios/PagerScrollDelegate.swift |
Updates delegate event calls. | None |
ios/Package.swift |
Defines SwiftPM targets and dependencies. | None |
.gitignore |
Ignores SwiftPM artifacts. | None |
.github/workflows/ios.yml |
Adds SwiftPM iOS build support. | None |
.github/workflows/ci.yml |
Adds the SwiftPM CI job. | Moderate (4 votes): include ios-spm in the required checks and result validation. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🟢 e2e: 20 passedAll 20 tests in 12 files
e2e 0.21.0 · 5m 9s · android · run artifacts |
🟢 e2e: 1 flaky, 12 passed
|
| Test | Time | |
|---|---|---|
| tests/smoke.e2e.ts · 1 flaky | 47.5s | |
| horizontal pager pages with the panel buttons (1 failed attempt first) | 47.5s | |
| 🟢 | tests/basic-pager.e2e.ts · 3 passed | 1m 22s |
| 🟢 | basic pager › in LTR › pages horizontally | 22.2s |
| 🟢 | basic pager › in LTR › pages vertically | 23.0s |
| 🟢 | basic pager › in RTL › pages horizontally with the reversed gesture | 36.6s |
| 🟢 | tests/issues/issue-1083-modal-set-page.e2e.ts · 1 passed | 12.7s |
| 🟢 | setPage called behind a native-stack modal lands on the requested page | 12.7s |
| 🟢 | tests/issues/issue-1096-keyboard-shrink.e2e.ts · 1 passed | 19.3s |
| 🟢 | keyboard avoidance does not shrink the page under the keyboard | 19.3s |
| 🟢 | tests/issues/issue-1098-nested-pager.e2e.ts · 1 passed | 20.8s |
| 🟢 | outer pager stays responsive after its page count changes around a nested pager | 20.8s |
| 🟢 | tests/issues/issue-1142-search-bar-inset.e2e.ts · 1 passed | 16.6s |
| 🟢 | FlatList inside the pager gets the search bar safe-area insets | 16.6s |
| 🟢 | tests/material-top-bar.e2e.ts · 1 passed | 15.4s |
| 🟢 | material top tabs survive a native-stack push and pop | 15.4s |
| 🟢 | tests/nested-pager-view.e2e.ts · 1 passed | 13.2s |
| 🟢 | nested horizontal and vertical pagers scroll independently | 13.2s |
| 🟢 | tests/on-page-selected.e2e.ts · 1 passed | 16.3s |
| 🟢 | onPageSelected fires an alert for every page change | 16.3s |
| 🟢 | tests/scrollable-pager-view.e2e.ts · 1 passed | 30.7s |
| 🟢 | pager inside a ScrollView keeps its page across vertical scrolls | 30.7s |
| 🟢 | tests/tab-view-inside-scroll-view.e2e.ts · 1 passed | 18.3s |
| 🟢 | TabView inside a ScrollView swipes tabs and scrolls the page | 18.3s |
e2e 0.21.0 · 5m 44s · ios · run artifacts
|
Looks good to me. I compared this with the SwiftPM implementation in react-native-bottom-tabs thats recently merged SMP support.
|


Summary
Adds SPM support to library
Library should work with both CocoaPods and SPM
Also adds step to CI that runs example with SPM - currently optional, can be treated as experimental
Test Plan
Run app with SPM - might be necessary to patch RNScreens - see CI setup
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md