Normally you only need the “Allow app extension API only” for extension targets, to get warned if you are accessing API which is not available for extensions. I had enabled it for a framework to make sure I didn’t call forbidden API.
I found this issue at the same time as this other issue because my client complained about both problems: Not seeing any documentation via Quick Help as well as the generated header unnecessarily containing internal classes. This problem was already present in Xcode 8, as evidenced by somebody asking about it on Stack Overflow.
For Swift-based frameworks/modules, Xcode generates an Objective-C header named Module-Swift.h. Ordinarily this only includes public classes. But if you turn on the “Allow app extension API only” setting, then also internal classes are included.
Steps to Reproduce
- Build the Module scheme of the provided sample app with Xcode 9
- Inspect the Module-Swift.h contained in the produced Module.framework
- You will see only the public classes CustomView and AncestorView
- Now turn on “Allow app extension API only” in the Module target build settings and build again
- Inspect the same header as in step 1.
- The generated Objective-C header should be identical regardless of the state of this setting
- With the setting off, only public classes are showing
- With the setting on, you also see the internal class SwiftViewController
Xcode 9.0 (9A235)
iMac or MacBook, with Xcode 9 and macOS 10.13
Categories: Bug Reports