Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a cocoa-touch Framework with search path similar to <Google/Analytics.h>

I'm trying to create a cocoa touch framework with a header file that follows this pattern:

 #include   <Compay/Product.h>

instead of the usual

#include <Product/Product.h>

for example #include <Google/Analytics.h>

instead of #include <Analytics/Analytics.h>

In xcode 7?

like image 627
Mr.Me Avatar asked Oct 31 '22 16:10

Mr.Me


1 Answers

Update

Based on comments from the OP and notes in the documentation. I would suggest changing the Public Headers Folder Path found in Build Settings under Packaging:

"...Set the Subpath to include/companyname/${PRODUCT_NAME}"

public-headers-folders-path

The detailed tutorial below covers this in context and how to manage multiple frameworks using the same project.

Additional Reference

Have you tried the simplest possible thing? (I've never done this, just thinking of the most straight-forward way to achieve the objective) - Create the new Framework and call it CompanyName. - Add headers as needed - Build and Run - Integrate with your app ~ Should see the Company/headerfile.h as desired

Apple docs on configuring headers state the following:

Next you will add a Copy Files build phase for exporting your headers. New static library targets created with Xcode 4.4 or later will come with an appropriately-configured Copy Files phase for headers, so you should check to see if you already have one before creating one. If you do not, press “Add Build Phase” at the bottom of the target editor and choose to “Add Copy Files.” Disclose the new Copy Files build phase and set the Destination to “Products Directory.” Set the Subpath to include/${PRODUCT_NAME}. This will copy files into a folder named after your library (taken from the PRODUCT_NAME build setting), inside a folder named include, inside your built products directory. The include folder inside a build products directory is in the default header search path for applications, so this is an appropriate place to put header files. Putting header files inside a folder named after your PRODUCT_NAME will allow you to segregate library headers by library name, for clarity.

Which seems to imply a way for you to manipulate the directory structure so that you get the includes structure you want. See the update, which presents a simpler way to manage the folder structure using the Public Headers Folder Path Build Setting. The detailed tutorial provides a good understanding of this in context, along with visual samples of managing multiple frameworks. Perhaps just changing the product name as used above will get your company name output as desired.

Extended Info

iOS Framework - Detailed Tutorial

Swift Frameworks

like image 188
Tommie C. Avatar answered Nov 15 '22 09:11

Tommie C.