0

I have a Swift / Parse iPhone project in Xcode. I have added Parse frameworks and as long as I import Bolts and import Parse in my swift file I am able to use all parse functions. I am now wondering, why do I need the Obj C bridging header at all? Currently there is nothing in it, yet everywhere it says that you need to properly setup your bridging header for Parse to work in Swift projects?

Christophe
  • 68,716
  • 7
  • 72
  • 138
Kashif
  • 4,642
  • 7
  • 44
  • 97
  • 1
    It depends entirely on how your project is set up. The bridging header is only necessary when you have Objective-C & Swift code *in the same project* that needs to see each other. If these things are in other projects, it works differently. – nhgrif Jun 25 '15 at 12:07
  • @nhgrif: Well the whole parse framework is in Obj-C, so technically bridging header is required, then how is it working without? – Kashif Jun 25 '15 at 12:39
  • Is it in the same target? – nhgrif Jun 25 '15 at 12:39
  • yes, I only have one target and all swift files and frameworks are in it. – Kashif Jun 25 '15 at 12:41

1 Answers1

1

The difference is in your deployment target. For iOS8, you can use embedded frameworks, so you can import frameworks just with a simple import FrameworkName. If you use CocoaPods, you can add use_frameworks! directive to your podfile and you can then use all pods as Frameworks without a bridging header.

If you want to provide a support for iOS7, you have to still use a bridging header, because embedded frameworks are not supported with this version of iOS.

VojtaStavik
  • 2,312
  • 1
  • 18
  • 30