Make a framework with Swift <-> Objective-c

Image of an objective-c class referencing a swift class and a swift class referencing an objective-c class

Typically when you want swift and objective-c to play nice with each other you need to make a bridging header. As of Xcode 7.2, this functionality is only available on a project but not a framework. Bummer. The good news is the “umbrella framework header is a fairly good substitute. Not perfect, but it is decent.

In the image above we have three files. The first one is the “umbrella framework header” which exposes the public stuff. If you notice I made the TestClass.h file a part of that “umbrella framework header” and by doing so I am able to reference TestClass object in swift.

However one would quickly notice that the objective-c class is unable to reference the swift class. Not to worry. You just need to reference the TestFramework-Swift.h in every objective-c class.