New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Any plans to add SPM packages support? #629
Comments
Oof, guess I need to wait for a bit then |
@kabiroberai published Orion as v0.9 to have developer feedback so Orion can be finalized as a tool in itself. Once that’s done, we can start planning support for SPM |
Since 1.0.0 is now in the process of being released I think it's a good time to start thinking about this. I'll transfer this issue to the main Theos repo first since it's applicable to Theos as a whole. |
Right – so the thing about SPM (and dependencies in general) is that they're tricky to use correctly with tweaks, since tweaks inhabit another process' address space. This means that there are a few atypical considerations involved:
These issues are partly mitigated by dyld's two-level namespace, but Objective-C classes don't respect the two-level namespace at all and Swift classes care more about the module name, which will indeed end up clashing if you're using the same framework. For these reasons, it's a non-goal for Theos to make it too easy to add third-party deps to tweaks; however, this is still something we should implement for the goal of Theos for the App Store (#286). At the moment, the easiest option is probably to turn the dependency into an xcframework using something like swift-create-xcframework, extract the desired .framework, and link against it as you would with any other framework while using Theos. You'll also have to add the framework to your deb, for example by placing it in Again, you'll need to make sure that the aforementioned issues are taken care of if you're using this approach. A better option for a small-ish framework like Defaults would be to include the source files in your tweak itself, with something like git submodules. |
@kabiroberai what about libraries such as swift-argument-parser? Would you recommend just including it’s source? |
For swift-argument-parser in particular it's likely you'd be using it in a standalone tool, which falls into the same bucket as full apps. In either case Theos should support SPM packages, but doesn't yet. In the meanwhile, either including its source or using the xcframework approach should work fine. You could even build it as a static library with Xcode and then link that using Theos. |
I tried to use this approach for tweak but didn't it work so far. I built xcframework from package added it to tweak, it compiled well, but the tweak doesn't even load (without new framework it loads well) |
I just tried using a package called Defaults, I added it to the
Package.swift
file and ran the build. But it seems like Orion doesn't support SPM packages yet.So, any plans to add SPM packages support? or am I doing wrong?
Here's the
Package.swift
file:And here's the error log:
The text was updated successfully, but these errors were encountered: