The Problem
Recently I was given a very large library that I needed to include in my App.
I was unsure if this library was going to be a permanent addition to the App, so I decided to put it into a Swift Package.
The first issue I ran into was that it was 80MB, way over GitHub's 50MB limit
No problem, I enabled Git LFS and moved on
After adding the package to my App I was getting issues that git lfs was not installed. I can asure you it was, however Xcode could not find it.
So, I linked it: `sudo ln -s `which git-lfs` `xcode-select -p`/usr/libexec/git-core/git-lfs`, this actually fails, you have to run: Settings / Privacy & Security / App Management then tick on "Allow the applications below to update or delete other applications" and then it works
When I sync again, I get a different error about the Remote Object not being there, again, I asure you it was.
The `fix` was to run Xcode like this: `GIT_LFS_SKIP_SMUDGE=1 open /Applications/Xcode.app` - however that's just unworkable, no-one is going to remember to do that.
The Fix
Take the xcframework and zip it up: `zip -r My.xcframework.zip My.xcframework`
Compute it's hash: `swift package compute-checksum My.xcframework.zip`
Then add that to the Package.swift
.binaryTarget(
name: "My",
url: "https://some_public_url/My.xcframework.zip",
checksum: "hash of the zip"
)
Finally it works, Xcode downloads this package into the Artefacts folder in your derived folder