Search code examples
iosobjective-cswiftios-frameworksobjective-c-swift-bridge

Call Swift from embedded Objective C framework


I have an app written in Swift called ColorApp which makes calls to ASwiftFramework (a collection of my swift files) as well as AnObjCFramework (an embedded framework of Objective C files). In my top level bridging header I only have: #import AnObjCFramework/AnObjCFramework.h>.

I have an error in a class in AnObjCFramework, and I wrote a fix which I incorporated into a new Swift class. I'd like to call this swift class (yes, it is a subclass of NSObject), from a class in AnObjCFramework. Is that possible?

I understand it is easier to just fix the Objective C code, but I'd like to understand better how to work with mixed libraries.

To summarize:
ColorApp (Swift) --> ASwiftFramework (Swift)--> AnObjCFramework (ObjectiveC)-> (Swift Class)


Solution

  • OK, after searching through the frameworks archives here, I realize I really shouldn't nest frameworks like this.