After putting about two weeks of effort into creating Swift bindings for the Godot engine, I’ve decided to abandon the idea. Here’s what I got working:
api.json
to generate Swifty wrappers around Godot’s classes_ready
, _process
etc.)Engine
, Input
etc.)However, Swift’s support for metaprogramming is terrible. Reflection is poorly supported (properties only) and there’s no support for macros or anything else that lets you create a metaprogram. Generics are severely crippled (cannot store constrained generics inside variables, cannot use Unmanaged
with protocols), closures are extremely restrictive (same problem with constrained generics). All of this to say that there is no way to create convenient wrappers that would let users of my bindings register their own classes and methods without mucking about with Godot’s native API to specify their own constructors, destructors and methods to write to and read from user_data
.
I wish Jonathan Blow would go ahead and release Jai into open beta, but in the meantime I plan to give godot-rust a shot.