iosobjective-cswiftswift-framework

Can't Use Swift-Generated Shared Framework in Objective-C


This is a variant of the old "dyld: Library not loaded: @rpath/libswiftCore.dylib" problem. I'm pretty sure I know what the issue is, but I don't have any ideas on how to fix it.

I'll reference the project I'm working on, so I don't clutter the question with huge blocks of code.

The project generates a dylib that can be thrown into another project, and abstract a huge block of coding for developers (a communication layer of a client/server system).

I want the framework to be as simple as possible to to use; even if that means making it a big fat pig. I just want people to be able to toss it into their project (Swift or ObjC), and not have to worry about playing around with different variants for things like simulators and devices.

I use a variant of the old Wenderlich script to lipo the executables for x86 and ARM together.

Note the commented-out section. There be draggones.

Works great. In Swift.

Objective-C, not so great. That's because of the various Swift frameworks that need to be carried into the Objective-C program.

I switched on the embed frameworks setting, and the target dutifully gives me all my frameworks.

The problem is that each architecture has frameworks for ONLY that architecture. They aren't "fat" frameworks, so my hand-built "fat" framework really is kinda skinny, because it will only work on certain architectures.

My question is whether or not there's a way to ensure that the Swift frameworks I embed can be made "fat," or if I just have to give up, and package different variants of the framework for Objective-C programmers.

Any ideas?


Solution

  • I'm giving up on this sucker.

    You cain't git thar f'm here.

    This library will be Swift-only.