I have a project with mixed code (objective-c and Swift) that I need to package as a framework. It also uses some external frameworks.
My umbrella header has many imports to different headers of the frameworks I use, as well as to the objective-c source code in my project (so that it's accessible by the Swift code). I also have a swift file, e.g. MyFramework.swift, that has some code that I'd like to expose to users of the framework.
The framework compiles, however, when I try to use it in another Swift project, I cannot access the contents of MyFramework.swift. That is the case even though the file exists (with the Swift source code) in the framework product!
Yet, I am able to access the objective-c code from the public headers. So I tried to write the code in MyFramework.swift in objective-c instead (MyFramework.h & MyFramework.m), because I thought it might be a problem exposing code in both objective-c and swift (though from what I read - it shouldn't be). That did the trick in terms of accessing the objects inside this class, but then I got a linker error:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_MyObject", referenced from: __TZFC12TestFW6MyObject20testfMS0_FCSo16UIViewControllerT_ in ViewController.o ld: symbol(s) not found for architecture x86_64
This actually happens for every public swift class I try to reference. I made sure these files exist in the "Compile Sources" list under Build Phases of the project settings, so that's not the problem.
I'm pretty clueless. Any ideas? Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire