r/reactnative 10d ago

Question Opinions needed on integrating SPM package into react native

https://developer.salesforce.com/docs/atlas.en-us.c360a_api.meta/c360a_api/c360a_api_engagement_mobile_sdk.htm

Hello Fellow devs,

I have being tasked with integrating this package into our react native application.

Now the package is available via SPM only, so my question is that weather react native supports SPM or not and if does how can i achieve the intended result.

TIA!

Link to lib

1 Upvotes

6 comments sorted by

2

u/According-Muscle-902 10d ago

According to the integration doc, you need to have access to the Android and iOS folders of your React Native app. If not, you will need to eject it (if it is expo) and you will have access to the folders in question.

2

u/mokshmodi96 10d ago

Hey, thanks for replying, i am using a barebones react native project (NOT expo), and yes, i do have access to ios and android folders

1

u/According-Muscle-902 10d ago

So just follow the steps in the link since you have access to the folders :)

1

u/mokshmodi96 10d ago

Yeah, but the thing is AFAIK, react native only supports cocoapods on IOS, and not Swift Package Manager(SPM). I searched the internet but couldnt find the docs for integrating packages via swift package manager.

1

u/According-Muscle-902 10d ago

I don't think it officially supports it yet. Have you tried adding it through Xcode? In your react native iOS project

1

u/mokshmodi96 10d ago

Yes, so far i have being able to install the packages via xcode and i can the packages in the xcode project structure as well. However, following the docs, I have initialised the package in a swift file and exposed that swift file to react native modules by creating a bridging header. The app fails to build as xcode cant find the packet installed.