Releases: tayloraswift/godot-swift
Swift for Godot is here!
Swift for Godot is here!
https://github.com/kelvin13/godot-swift
Godot Swift provides bindings and a Swift Package Manager-powered build system for creating Godot native libraries from Swift frameworks. Godot Swift exposes GDScript APIs in terms of Swift protocols and generics, allowing for seamless Swift-to-Godot interoperability.
Godot Swift automates nearly all of the process of registering types and members with the Godot runtime, and ships with an expressive, SIMD-accelerated math library. It also has comprehensive API documentation and tutorials.
Here’s a minimal 35-line example of a Godot Swift nativescript:
final
class MySwiftClass:Godot.NativeScript
{
var foo:Int = 5
init(delegate _:Godot.Unmanaged.Spatial)
{
}
func bar(delegate _:Godot.Unmanaged.Spatial, x:Int) -> Int
{
self.foo * x
}
@Interface
static var interface:Interface
{
Interface.properties
{
\.foo <- "foo"
}
Interface.methods
{
bar(delegate:x:) <- "bar"
}
}
}
extension Godot.Library
{
@Interface
static var interface:Interface
{
MySwiftClass.self <- "MyExportedSwiftClass"
}
}
How you can help!
Godot Swift comes with a resource installation script that automates creating and installing .gdnlib
and .gdns
resource files for its build products. While Godot Swift itself is written is pure Swift, and should work on all platforms, the resource installation script currently only works on Linux. You can help port it to Windows and MacOS! (This should only require updating a few file extension patterns.)
Beyond that, Godot Swift could always use testers and tutorial writers. Feel free to open a Github issue for any questions or concerns.
Have fun!