CocoaPods may have a search path that includes the main application

This is my first time writing my own Cocoapod, so it can be a really simple quedstion, but ....

I am trying to use Cocoapods to distribute common code for a number of applications used in our company (CocoaPod is called CommonHex with the HEX prefix, therefore HEXItem.h / m). However, we do have a configuration file specific to each HOSTConfig.h / m application. Is there any way to access this HOSTConfig.h / m from our CommonHex package?

It would seem that I should have, for example, a configuration file that will have its own values, but will it be for HOSTConfig.h / m, if it exists? And you probably have to expand the search path or something else.

So, I like:

MainApp \-MainApp \-HOSTConfig.h/m CommonHex \-Classes \-HEXItem.h/m \-HEXItemViewController.h/m 

I would like it to be able to access HOSTConfig.h / m, possibly through another class, if HOSTConfig.h / m exists in the hosting application, it uses these values, otherwise it uses the values ​​in our CocoaPod

change # 1

so in CommonHex.podspec I have the following, but this does not seem to work:

  s.source_files = "Classes", "Classes/**/*.{h,m}", "$(PROJECT_DIR)/HOSTConfig.{h,m}" 
+6
ios cocoapods
source share
2 answers

If you are looking for access to some header file (for configuration data) in the MainApp project from any Pod project, then the problem is providing the correct path variable in the pods project.

Just add

 "$(PROJECT_DIR)/.." 

along with quotes in the User Header Search Paths build settings and remember to select recursive.

This will allow you to see the visibility of the Pod header for the main project without changing the podfile.

Example: enter image description here

+4
source share

If you just want to read the values ​​for the configuration, probably the best way is to have some plist file, and then check with the module if it exists in the package or by default the one that is in the module.

+1
source share

All Articles