How to use private header files in .testTarget

Hi guys,

I am trying to wrap a legacy objective-c framework into swift package, and everything works quite nicely so far with the structure like this:


I took all the public api headers and put them under Sources/AAA/include/AAA. I took the sources and put them under Sources/AAA/src. I specify include in publicHeadersPath in the target description.

The package builds, and can be used in other packages.

Now I am trying to migrate existing tests, but the issue is that the test .m files include private header files that are now shipped inside Sources/AAA/src. Since these are just private include files, I do not want to expose these header files to the outer world, so I am looking for a trick how to make the tests compile and how to give them access to the Sources/AAA/src for the CFLAGS .headersPath option?

What am I missing please? that must be simple right?

thanks for your help,

P.S. the code in question is messy and wip here: GitHub - mman/Parse-SDK-iOS-OSX at spm

You should be able to use relative paths like we do in the Firebase repo (line 237):

Hope that helps!


Thanks @Ryan_Wilson for the suggestion, it took a couple of tries to get the right amount of ../ in the path, and it seems to work great.

1 Like