I followed a tutorial to create a static library project. Then I dragged in my classes and added them to the target.
When I build & run, it creates a libUtils.a file. Upon reveal in Finder the include folder only contains the header file for the first class that Xcode created automatically when I created the project. All other header files are missing.
I double-checked: All the added class files are part of the project and the inspector shows a target membership checkmark for the target project.
Is this a bug in Xcode or must I register all files I create additionally somewhere else?
Add Headers files
Xcode 10.2.1
Project editor -> select a target -> Build Phases -> + Add a new Build Phase -> New Header Phase
The second step is to add .h
files
//Build Phases
Project editor -> select a target -> Build Phases -> Headers -> add files to the **public** zone
//or
//Target Membership
Select `.h` file -> Select File Inspectors Tab -> Target Membership -> Select the target and make it **public**
Xcode automatically adds a build phase to copy the headers to the product directory. You can add new header files to this build phase:
Update:
You can also use “Copy Headers” build phase instead:
Editor menu > Add Build Phase > Add Copy Headers Build Phase.
And the header files will be added automatically to one of the categories when you add them to the project:
More info about this build phase and the three categories from iOS Developer Library.