1

I am creating a Turbo Module for React Native. The TM depends on another pod that I have created locally. I'm getting a compilation error stating that my generated -Swift.h header file is missing.

Heres the setup:

I have a local pod (lets call it "MyLocalPod") that is written in Swift. It is intended to use this pod with Objective-C code from my Turbo Module, so I have placed @objc attributes to the relevant public code in the pod. I have also updated some structs to be class objects that extends NSObject as well.

I have a React Native Turbo Module package setup with an example RN project included. The TM package's podspec uses the above local pod like so:

s.dependency "MyLocalPod"

Now I know you cannot add a local development pod to a podspec file so I used a workaround from this answer https://stackoverflow.com/a/49422999/10820594. My example app's Podfile is like the following:

pod 'MyLocalPod', :path => '/Users/dev/Projects/MyLocalPod'

In my Objective-C (.mm file) source code for the TM I import my local pod like:

#import <MyLocalPod/MyLocalPod-Swift.h>

But I always get a compilation error when I run npm run ios that says fatal error: 'MyLocalPod/MyLocalPod-Swift.h' file not found. The MyLocalPod-Umbrella.h file is found, but not the -Swift.h file.

I have tried a few things:

  1. Cleaned the product build, manually deleted DerivedData, and deleted Pods folder and Podfile.lock before completely re-adding the TM, codegen, and pod install multiple times (and in different orders)
  2. I manually built MyLocalPod before doing pod install in the example app
  3. Found the generated MyLocalPod-Swift.h header file deep in DerivedData and added its path to HEADER_SEARCH_PATHS in XCode
  4. Set Defined Modules to YES in MyLocalPod's target's Build Settings

Each possible fix never found the generated -Swift.h file.

0 Answers0