My Framework's PCH file isn't applied after adding a Swift file to the project, Podfile

37 views Asked by At

I have a Workspace with 2 projects, where one is a "common" project with code to share between projects and targets and the other is my main IOS app. So, I have a podspec for it, and use that in my "main" projects podfile. This has worked well for years.

Now, my "common" project has only contained objective-c files, and both it and my main project have PCH files where I have common imports.

I am about to migrate to Swift (long overdue) so, I tried to just add a Test.swift to my common project.

When I tried to do pod install, I got this error:

The Swift pod X depends upon JSONModel, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

So, I did that, but what happens now is that the project doesn't compile. More specifically, the #import's in my PCH files don't seem to be applied for some reason. PCH extract:

#ifdef __OBJC__
    #import "MyConstants.h"
#endif

Error example:

projects/iphone/Pods/Headers/Public/MyCommons/Status.h:47:30: Unknown type name 'Role'

, which is an enum, defined in MyConstants.h

The weird thing is that I put a #warning inside the #ifdef and it IS logged when every file is compiled, including Status.h that I mention above.

This is definitely not my expertise, so if someone knows more than me, pointers are appreciated. Optimally, I would like to be able to mix Swift and Objective-C in my commons module but still have the PCH file applied to the Objective-C files, until I have moved on 100%.

0

There are 0 answers