After successfully achieving exactly this with Android last week, there was still another major mobile platform to conquer, iOS!
Thankfully the community funding received so far ($289.69NZD) was just enough to cover the impulsive decision of mine to acquire a refurbished iPhone 8, I picked this version up as it's the lowest iPhone version supported by both Go + Godot and I got to work in the evenings to ensure that iOS development with graphics.gd could be just as accessible and well, the good news is, this was a lot easier than I expected!
So without further ado, I'm excited to share the IOS development workflow for graphics.gd :
- Install SideStore onto an iOS device in the same local network as your machine.
GOOS=ios gd run.- Scan the QR code with that device and tap the SideStore prompt to install.
- Launch the app from the iOS home screen.
Here's real-time footage of a cached re-compile of the graphics.gd Go shader sample project to iOS:
(It does take a moment to install, skip ahead or check out the important details below)
20250912_214904.webm
Now, I'll admit this isn't quite as quick or automatic as Android yet but my experience has shown that it's more than manageable and since you don't need a cable once it's setup, perhaps it's even better in a way!
Important Details
- No Apple Software nor Apple SDKs are bundled with, or downloaded by,
graphics.gd. - Projects can be built into an
.ipaon any development platform (ie. Windows/MacOS/Linux). - Everything is compiled into a single native binary.
- The only Apple account required for this process is the one on the iOS device.
- Free apple accounts without the Apple Developer License have restrictions of the number of different apps that can be installed this way (in practice, only a couple of them).
- The iOS device itself signs the app and (as I understand it) this meets Apple's requirements of restricting all of Apple's Software (including their Provisioning Profiles) to be used solely on Apple hardware.
- As such, apps built this way are unsigned, so without Xcode, they can only be installed via sideloading solutions such as SideStore or AltStore.
- It's possible to leverage the full iOS-supported capabilities of Go and Godot here, 2D, 3D, networking & more.
- Projects built with
graphics.gdinclude an.xcodeprojthat can be imported into Xcode as needed.
Behind the Scenes
For some time, I've been learning how Zig achieves libc cross-compilation for MacOS, which is very similar to iOS. Zig bundles an Open Source copy of the .tbd file used to dynamically link to LibSystem, it turns out these .tbd files are very simple .yml files that point at the library to link to and the list of symbols that can be located within that library. Here's what it looks like:
--- !tapi-tbd
tbd-version: 4
install-name: '/expected/path/to/dynamic/library/on/the/system'
targets:
- arm64-ios
- arm64-macos
exports:
- targets: [ arm64-ios, arm64-macos ]
symbols:
- do_something
- another_func
objc_classes:
- SomeClass
...
So in order to cross compile almost anything to MacOS or IOS, all you need to do, is run the cross-compiler, represent the required headers (note, this is easier said then done) and then observe the inevitable undefined-symbols errors from the compiler and to figure out which symbols belong to which system library (often they have a prefix that helps you to figure this out).
Go already compiles to MacOS/iOS with very little C headers and since Godot already distributes static binaries for iOS, I could almost entirely skip the headers and instead simply had to add each undefined-symbol to the appropriate .tbd file. So piece-by-piece I did this for all of the symbols that Godot + Go needs on MacOS/iOS, and I'm bundling the result fully Open Source with graphics.gd.
As a consequence of this, graphics.gd enables natively-compiled iOS applications to be developed in Go on any platform!