HomeiOS Developmentios - Use Swift open supply library with SPM

ios – Use Swift open supply library with SPM


I’ve a React Native app utilizing Expo, and I must combine a Swift open-source library that doesn’t have any React Native bindings. Since I must make some customized modifications to that library, I made a decision to clone the repository and embody it as a git submodule inside a customized Expo module I created.

The library itself makes use of Swift Bundle Supervisor (SPM), and that’s the place the issues start. I’m getting errors like
“… module not discovered” when the library tries to import its personal SPM dependencies. I believe this is because of conflicts between CocoaPods and SPM contained in the Expo iOS surroundings.

Right here’s what I’ve tried to date:

  1. Utilizing spm_dependency in my .podspec file.

  2. Cloning all the library’s dependencies into my module alongside the primary repo, and making a .podspec for every one to manually outline dependency relationships (this kind of labored, however rapidly turned unscalable).

  3. Attempting to convey the dependencies into the .podspec or Podfile, however the code is anticipating them by way of SPM, so it solely works with very outdated variations of the library.

  4. Utilizing Xcode > Add Bundle Dependencies to manually add the SPM packages, each to the primary mission and to the Pods goal generated contained in the Expo module (this didn’t work both — identical module decision points).

Notice: each time I strive one thing, I clear the iOS folder with:

-rf Pods construct Podfile.lock
pod set up --repo-update

So listed below are my questions:

  1. Is it potential to make use of SPM dependencies in a React Native Expo mission that makes use of CocoaPods?

  2. If I fork the library, make my modifications, and hold utilizing SPM (as an alternative of migrating to Pods), may that really work?

Every other concepts?

  • Node v22.12.0
  • Expo v0.22.26
  • React Native v0.76.9

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments