Norway


Normally you only need the “Allow 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 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.

Filed as rdar://34790796 and on Open Radar. The mentioned sample is on my Radar Samples GitHub repo, titled InterfaceTest.

Summary

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

  1. Build the Module scheme of the provided sample app with Xcode 9
  2. Inspect the Module-Swift.h contained in the produced Module.framework
  3. You will see only the public classes CustomView and AncestorView
  4. Now turn on “Allow app extension API only” in the Module target build settings and build again
  5. Inspect the same header as in step 1.

Expected Results

  • The generated Objective-C header should be identical regardless of the state of this setting

Actual Results

  • With the setting off, only public classes are showingradar: [xcode] enabling extension-safe api check changes generated objc-header - Bildschirmfoto 2017 10 03 um 17 - Radar: [Xcode] Enabling Extension-safe API check changes generated ObjC-Header
  • With the setting on, you also see the internal class SwiftViewControllerradar: [xcode] enabling extension-safe api check changes generated objc-header - Bildschirmfoto 2017 10 03 um 17 - Radar: [Xcode] Enabling Extension-safe API check changes generated ObjC-Header

Version/Build

Xcode 9.0 (9A2)

Configuration

iMac or MacBook, with Xcode 9 and macOS .13


Categories: Bug Reports



Source link

No tags for this post.

LEAVE A REPLY

Please enter your comment!
Please enter your name here