XcodeGen
XcodeGen copied to clipboard
How to declare a Carthage built XCFramework dependency?
I'm preparing my project for the upcoming Carthage release, which will build dependencies as XCFrameworks. How do I properly indicate a dependency on an XCFramework in my project.yml project spec?
Second question: Is there a way to disable the carthage copy files script being automatically added:
If any applications contain carthage dependencies within itself or any dependent targets, a carthage copy files script is automatically added to the application containing all the relevant frameworks. A FRAMEWORK_SEARCH_PATHS setting is also automatically added
For context, in the upcoming carthage release, they indicate that you'll no longer need to include a run script to call carthage copy-frameworks
, and including this would actually introduce breaking changes to the currently carthage update --use-xcframeworks
flow.
figured it out, since xcframeworks
don't need Carthage's copy frameworks run script anymore, you can just reference them in the dependency target like so
targets:
MyApp:
dependencies:
framework: "Carthage/Build/iOS/Alamofire.xcframework"
and then you're good to go.
Is there any plan to update the XcodeGen to allow carthage: Alamofire
to find the XCFramework? The shorthand is still nice to avoid entering in the full path to the dependency. Especially now that Carthage has been released to support building XCFrameworks.
I've put up a draft PR for this here #1020, if you'd like to test it
Would appreciate some testing of this to make sure it works on your projects. You can use Mint to test it easily
mint run yonaskolb/xcodegen@carthage-xcframeworks xcodegen
I replied to the PR that was linked the my results from testing it (https://github.com/yonaskolb/XcodeGen/pull/1020#issuecomment-918304960) but I also wanted to reply here too.
One issue I've noticed with added an xcframework from carthage as a dependency when the project also has a framework target and an app target.
- If added to the app using
framework
it works fine - If added to my framework target the app will fail to launch cause the xcframework wont be copied into the app. Previously the copy script from carthage was copying in the frameworks and stripping out symbols. Striping out the symbols is no longer needed, but copying the frameworks is.