vendredi 1 avril 2016

Import private headers from Pod into Testing Target

I have an Objective-C project that is distributed using CocoaPods, and the example project is configured with a Podfile so that it can test the installation of the library via CocoaPods. Here's the relevant part of the podspec:

s.default_subspec = 'Core'

s.subspec 'Core' do |sp|
    sp.source_files = 'Pod', 'Pod/Classes/**/*'
    sp.private_header_files = "Pod/Classes/Private/*.h"
end

Notice that I'm hiding some files in Pod/Classes/Private because I don't want to expose them as public API.

I have a Tests target in my Example project, and I'd like to import the files from Pod/Classes/Private into my tests so I can, well, test them.

How can I do this? Do I have to add a Testing subspec, and just hope no one uses it? If I try to #import "SomePrivateHeader.h" in my Testing target, I get a simple "file not found" error.

Note: I'm not trying to hide sensitive information. Just trying to protect users from implementation details.

Aucun commentaire:

Enregistrer un commentaire