r/iOSProgramming • • 23h ago

3rd Party Service Build Xcode projects on Linux with SweetPad

https://sweetpad.hyzyla.dev/blog/2026/11/21/build-xcode-projects-on-linux/

Hello! I would like to share my CLI that allow to build native iOS applications on Linux. It works with Xcode projects with zero changes and make possible to build native ios applications without macOS at all

9 Upvotes

8 comments sorted by

2

u/pandaro 14h ago

sweet serendipity! i started working on same yesterday.

tried on a real app: ~215k lines of swift in about 630 files, plus at least one vendored c library (libopus). it's 7 xcode targets: a swiftui ios app, share and notification extensions, an embedded watchos app, and test targets. it also uses local swiftpm packages and has git swiftpm dependencies. fresh deb 13 vm, 8 vcpu, sweetpad 0.1.28 from the apt repo, sdk imported from the xcode 27.2 .xip.

the device and simulator builds just worked (unsigned): 142 s cold for generic/platform=iOS, 18 s incremental, and the simulator build succeeded too. very impressive. three things i hit:

1. test build fails on watchos links: unknown argument: '-fuse-ld=lld'

the failing tasks are swiftc-driven Ld steps (swiftc -emit-library) for a swiftpm library product that swift build builds as a dynamic ..._PackageProduct.framework for watchsimulator. in the same build log, the swiftc links for the same kind of dynamic product on iphonesimulator get -use-ld=lld -ld-path=.../ld64.lld, while the watchsimulator ones get -fuse-ld=lld -ld-path=.... swiftc has no -fuse-ld. i re-ran the failing command by hand with -use-ld=lld swapped in, and it links fine and produces a mach-o. so it looks like the watchos path picks the clang spelling of the flag for a swiftc-driven link. the scheme has watch unit and ui test targets. i haven't built a minimal repro.

2. setup sample build rejects its own cache directory under umask 0002

error: Setup sample build failed: cannot prepare build utilities: build utility cache must be owned by the current user and writable only by that user: ~/.cache/sweetpad

~/.cache didn't exist before the first sweetpad run. afterwards ~/.cache/sweetpad and ~/.cache/sweetpad/swift were 0775, while ~/.cache/sweetpad/distribution was 0700. that's consistent with the mode only being applied to the leaf of a recursive mkdir. this was a regular (non-root) user on a stock debian 13 cloud image, where the login umask is 0002 (user private groups). root and most containers get 0022, so they won't see it. after chmod 700 ~/.cache/sweetpad, doctor is clean and builds work. i didn't re-run setup's sample build itself.

3. (minor, maybe intended) --json failure envelope goes to stderr

on success the envelope is on stdout. on a build failure, stdout is empty and the {"ok":false,...} envelope is on stderr, so > out.json only captures successes. if that's deliberate, a line in the docs would help.

1

u/hyzyla 1h ago

Thanks for feedback ! Looking into those 👀

1

u/zellJun1or Foundation 23h ago

Isn’t it using the open source foundation for Linux which is not complete?

2

u/hyzyla 23h ago

No, no. It links agains Apple SDKs (aka original Foundation). Unfortunately to run you need to have iOS or macOS. But at least building is now possible

2

u/Fair_Sir_7126 8h ago

SweetPad is the best

2

u/Zenmodo 18h ago

FYI linking against the SDKs in any way on a non-Apple platform is against their developer program terms and if caught doing this can result in your developer license being suspended.

> You agree not to install, use or run the Apple SDKs on any non-Apple-branded computer

Other versions of this idea have been done in the past but don’t gain much traction for this reason.

1

u/ct_the_man_doll 1h ago

I wonder if we might see someone work on a open source SDK for Apple devices.

-4

u/pandaro 14h ago

that's explained in op's doc; don't get sanctimonious without taking three seconds to look first.