Swift Programming Language for Godot using SwiftGodot

Miguel De Icaza, the founder of Xamarin and Ximian before that, the creators of the Mono cross platform C# development platform as well as the GNOME Linux desktop, has just brought Swift programming language support to the Godot game engine. Using GDExtension, the Godot 4.x extension mechanism used by other language implementations such as Rust (learn more), D, Go and Haxe (learn more), SwiftGodot enables Godot developers to use the Swift programming language in two different ways.

Details from the GitHub repository:

SwiftGodot provides Swift language bindings for the Godot 4.1 game engine using the new GDExtension system.

SwiftGodot can be used to either build an extension that can be added to an existing Godot project, where your code is providing services to the game engine, or it can be used as an API with SwiftGodotKit which embeds Godot as an application that is driven directly from Swift.

Driving Godot from Swift has the advantage that on MacOS you can debug your code from Xcode as well as the Godot code.

Consuming SwiftGodot

There are two ways of consuming SwiftGodot, you can either reference this module in SwiftPM by using this address – and it will trigger a complete source code build for you, or to quickly iterate on MacOS, you can use a convenient binary in the peer https://github.com/migueldeicaza/SwiftGodotBinary

Currently this requires Swift 5.9 or Xcode 15.

Working with this Repository

You should be all set by referencing this as a package from SwiftPM but if you want to just work on the binding generator, you may want to open the Generator project and edit the okList variable to trim the build times.

Driving Godot From Swift

To drive Godot from Swift, use the companion SwiftGodotKit module which embeds Godot directly into your application, which allows you to to launch the Godot runtime from your code.

Key Links

Swift Godot Repository

Swift Godot Kit

Swift.org

You can learn more about the SwiftGodot GDExtension bringing swift support to the Godot game engine in the video below.

Scroll to Top