How to add an Obj-C bridging header to a Swift framework target in Xcode 10

You can’t, but here’s how you work around it. (Xcode 10.1 generates a compile error if you try to specify an Objective-C bridging header for a framework target.)

  1. Select the header file(s) you wish to bridge, and in the Target Membership section of the File Inspector, check to include it in your framework and then mark it as Public in the dropdown that appears.
  2. Include the header file(s) in the main header file of your framework.
#import <MySDK/MyHeaderFile.h>

Source: Stack Overflow (naturally!)

(This was the first time I’d ever seen the Public / Private / Project dropdown under Target Membership. I guess it’s only for headers, which you don’t typically manually include in a target.)

Author: Mark

Mark is an American computer programmer living in Switzerland.