0

In this example project, comment out the one #import line in BridgingHeader.h and it will yield an error of unresolved identifier in AppDelegate.swift

https://github.com/lacyrhoades/GLSlideshow/tree/stackoverflow

As another approach, and what I understand is the "correct" approach, if in AppDelegate.swift we add import GoogleCastRemoteDisplay this does NOT fix the error, but it makes a new one saying no such module GoogleCastRemoteDisplay

Is this a problem with the library's podspec? I want to make my own Pods but I am confused: When is a bridging header needed for a Pod, when is it not?

snakeoil
  • 497
  • 4
  • 12

1 Answers1

1

A bridging header is required when you use Obj-C based pods. If you use a swift based pod, no bridging header is required.

An easy way to add it is to create a new Obj-C based class in your swift based project (name it whatever. It doesn't matter). When you do that it will ask you if you want to automatically add the BH. Say yes and then delete the class you just created leaving the BH. Import all Obj-C headers here.

Hope that helps.

crewshin
  • 765
  • 9
  • 22
  • That's what I'm wondering because it seems like SOME Obj-C based pods do not require a bridging header. At least not as an end user in the latest versions. You simply say `pod "library"` in your Podfile and then you can `import Library` in Swift land. – snakeoil Aug 20 '16 at 15:42
  • Every Obj-C based pod is required to be imported with the bridging header. 1: Add pod to Podfile. 2: Add framework to the bridging header with the `#import "AFNetworking/AFNetworking.h"` format. The initial AFNetworking before the / is the folder that the framework is in. So the entire thing is the path to the header to import. Also, don't use `<>`. – crewshin Aug 24 '16 at 05:46