iOS + Objc/Swift + External frameworks inside a package


I am wondering if it's possible to create a package that contains Objc/Swift and uses an external framework like OpenCV. Can you include a precompiled framework inside of a package?

You'd have to wrap OpenCV in a package somehow.

I do know this packages can only depend on other packages. There may be "hacky" ways around this if it's all tied into a single project but I don't know if that's worth doing vs wrapping it. Is OpenCV a C library? If so it can be pretty easily wrapped as a system library and provided to a package that way.

In answer to the mixed ObjC/Swift you can put them both under the same package but they must live in separate targets. So you might be able to have Swift dependent on ObjC dependent on other Swift (depending on the code structure) all under one package. We're going through this right now converting a bunch of existing embedded frameworks and static libraries to use SPM.

Hope that helps even a little :stuck_out_tongue:

Thanks for the reply,

Unfortunately OpenCV is c++. I believe there is a c api, but we use c++. I looked around and there does seem to be a hacky way to link a custom binary framework as a system framework. I'll give it a go, but doesn't look promising.

SwiftPM supports C++ about as well as it does C.

This will be possible with the binary dependencies feature.

Any idea on when that proposal will be implemented? Or how I can track it? Thanks!