Blog Logo
TAGS

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

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. You can browse the API documentation and it can also be edited for local use, if you enable it in the Generator. Consuming SwiftGodot has two ways - referencing this module in SwiftPM or using a convenient binary in the peer. Working with this Repository is as simple as referencing it as a package from SwiftPM. Driving Godot From Swift is made easy with the companion SwiftGodotKit module which embeds Godot directly into your application. Creating an Extension in Godot requires a few components such as your Swift code, a .gdextension file, Swift registration code, bootstrap code, and importing your extension into your project. Your Swift code will be compiled into a shared library that Godot will call. To create an extension, you need to create a Swift Library Package that references the Swift Godot package.