Develop native iOS apps in Go, on any platform, without the SDK! #184
Replies: 3 comments 6 replies
-
|
Hello! First of all this super cool. I've been having a lot of fun writing a little game for my kids with it. But I really don't like the idea of having to side load the app onto their iPads. Seems fine for dev and testing but is it actually possible at all to publish it on the iOS App Store? |
Beta Was this translation helpful? Give feedback.
-
|
I'm a vim guy so I generally prefer to stay in the command line if I can. May need some guidance on it but for now I'm having trouble building for iOS. I may need to open a separate issue unless it's just my env. I'm getting a bunch of errors about undefined symbols when building with GOOS=ios stuff like: awinn@adams-MacBook-Pro go-space-empires % GOOS=ios gd build
error: undefined symbol: _$s11Coordinator7SwiftUI29UIViewControllerRepresentablePTl
note: referenced by go-space-empires.xcframework/ios-arm64/libgodot.a(app.ios.template_release.arm64.o):l_got.$s11Coordinator7SwiftUI29UIViewControllerRepresentablePTl
error: undefined symbol: _$s20UIViewControllerType7SwiftUI0aB13RepresentablePTl
note: referenced by go-space-empires.xcframework/ios-arm64/libgodot.a(app.ios.template_release.arm64.o):l_got.$s20UIViewControllerType7SwiftUI0aB13RepresentablePTl
error: undefined symbol: _$s4Body7SwiftUI3AppPTl
note: referenced by go-space-empires.xcframework/ios-arm64/libgodot.a(app.ios.template_release.arm64.o):l_got.$s4Body7SwiftUI3AppPTl
error: undefined symbol: _$s4Body7SwiftUI4ViewPTl
note: referenced by go-space-empires.xcframework/ios-arm64/libgodot.a(app.ios.template_release.arm64.o):l_got.$s4Body7SwiftUI4ViewPTl |
Beta Was this translation helpful? Give feedback.
-
|
had to change some things in xcode but I was able to build it there an deploy on my phone! I should have written down what I changed but I can do it again later an documen that. I did notice that when building for ios the godot pack file is not updated so I have just been copying it in there for now |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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.gdcould 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:GOOS=ios gd run.Here's real-time footage of a cached re-compile of the
graphics.gdGo 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
graphics.gd..ipaon any development platform (ie. Windows/MacOS/Linux).graphics.gdinclude an.xcodeprojthat can be imported into Xcode as needed.Behind the Scenes
For some time, I've been learning how Zig achieves
libccross-compilation for MacOS, which is very similar to iOS. Zig bundles an Open Source copy of the.tbdfile used to dynamically link toLibSystem, it turns out these.tbdfiles are very simple.ymlfiles 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: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-symbolserrors 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
.tbdfile. 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 withgraphics.gd.As a consequence of this,
graphics.gdenables natively-compiled iOS applications to be developed in Go on any platform!Beta Was this translation helpful? Give feedback.
All reactions