Fixing React Native Podfile to bridge and run swift native modules.

Ashutosh Bharti
2 min readApr 9, 2021

Quick back story :
I was stuck on an error to run a react native project using various native swift modules trying to bridge them across to get this app up and running.

After successfully bridging the native modules , I was using use_frameworks! and React Native’s native iOS dependencies are compiled as static libraries and many react-native node modules are only ever compiled and tested as static libraries. When trying to incorporate a dynamic framework (which Swift dependencies are often bundled as), compilation problems often ensue as shown below.

After some immense debugging , I found out the project has some native incompatibilities with using frameworks, so I switched to use_flipper!(). Since flipper uses remote debugging, which lets the app run in the environment as close to production one as possible, more precise than direct debugging.

(In case of you’re wondering ???)

In direct debugging case, the app is running on your local machine using V8 underneath. It is an issue because it can lead to errors or which may be missed just because they don’t appear on V8 or vice versa. Also, the performance of your app is different when running on your machine versus a real device.

On another note, enabling and configuring Hermes engine in your project will give you a significant performance boost and reduce the app size. Thats amazing , isn’t it?

Fast forwarding ,

Step 1 : Change your podfile configuration to the following:

Step 2: Use the latest flipper version, as well as SET the projects’ Other Linking Flags property to $(inherited).

Step 3: Remove pods folder , podfile.lock within the project’s iOS folder, with

rm -rf Pods/
rm -rf Podfile.lock

Step 4: Delete the XCode’s Derived data, clean the build folder, install the pods and build again.

--

--

Ashutosh Bharti

SDE2 || ML Enthusiast || JavaScript Lover || Keen to IoT || “Live for what’s worth dying for, and leverage technology to create the world you wish to see.”