Xcode: Copy Headers: Public or Private vs. Project?

I am creating a Cocoa Touch Static Library. How can I decide whether to copy the header file as open, closed or project?

+68
header xcode static-libraries
Sep 16 '11 at 1:18
source share
3 answers

Publication: The interface is complete and intended for customers to use your products. The public header is included in the product as readable source code without restrictions.

Private:. The interface is not intended for your customers or in the early stages of development. A private header is included in the product, but is marked "private". Thus, the symbols are visible to all customers, but customers must understand that they should not use them.

Project:. The interface is intended only for implementation files in the current project. The project title is not included in the target, except for the object code. Symbols are not visible to customers at all, only to you.

Source: Xcode Developer Library> Tools and Languages> IDE> Project Editor Help> Setting the Visibility of the Header File

+102
Nov 04 '11 at 10:15
source share

Randy's answer is good and gives you all the information you need. I wanted to add some information to help you based on how you expect your library to be used.

PROJECT:. If you distribute your project and expect users to include your project as a subproject on their own, you must make sure that the headers are marked as β€œproject”. This will not lead to such problems: Xcode 4 Unspecified Archived Version

Note that this applies to all subprojects ... including subprojects of subprojects, recursively.

PUBLIC: If you expect users of your library to refer only to your object (and DO NOT have your original project), make sure that the headers are marked as β€œpublic” (only for headers, you will need to refer).

+25
Mar 02 '12 at 4:16
source share

Public - allows access to the code in the same module or to another module that imports the module in which the code is declared.

Internal - allows access to the code in the same module, but not to any other module. This is the default Swift access level.

Private - restricts access to the source file in which the code is declared. Although usually one class, structure, enumeration, etc. is defined in the source file, you can declare more than one file per file.

enter image description here

These headers are a little misleading - all the headers will actually be visible to your customers and searchable in the search engine, but to import them into the umbrella header, you must explicitly make the headers public. [About Target Membership]

Source here and here

0
Aug 12 '19 at 20:15
source share



All Articles