Skip to content
CAI
Software that uses CAICheck a score

migueldeicaza/SwiftGodot

50.7

Adequate · 1 October 2026

21.3k

lines of production code

Swift

with C

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

SwiftGodot is a Swift library and toolchain that enables developers to create native Godot engine extensions and applications using Swift. It provides a code generation system based on Swift macros to bridge Swift types with Godot's GDExtension API, handling class registration, property exporting, and signal binding. The system includes runtime components for type safety and memory management, along with build plugins and test runners to streamline integration and verification.

How it got here

2023 — SwiftGodot foundation and macro implementation

20 changes.

This period established the SwiftGodot project by defining its repository structure, build infrastructure, and core GDExtension bindings. The team implemented the Swift macro library for code generation and developed comprehensive documentation and tutorials to guide integration. Concurrently, the testbed and generator modules were updated to support newer Godot versions and improved code organization.

2024–2026 — Runtime stability and testing infrastructure

16 changes.

This period focused on stabilizing the SwiftGodot runtime through significant refactoring of argument handling, bridging, and editor integration, alongside critical fixes for Windows shutdown and library reloading. Concurrently, the project established a robust end-to-end testing framework, introducing automated test discovery macros, a dedicated test runner, and comprehensive coverage for math types and built-in features.

Features

Add GDExtension C header bindings for Godot integration

The Sources/GDExtension directory now includes the necessary C header files (GDExtension.h, GDExtensionSupport.h, and gdextension\_interface.h) and a module map to expose the Godot GDExtension API to Swift/Objective-C code. This provides the foundational bridge definitions required to interact with Godot engine versions 4.1 through 4.7, enabling native extensions to call Godot functions and handle variant types.

Sources/GDExtension · high confidence

Add SimpleExtension demo showcasing Swift-Godot integration

A new example extension has been added to demonstrate how to create and bootstrap a Swift class exposed to Godot. The entry includes a README with setup instructions, a .gdextension configuration file targeting Godot 4.2+, and a Swift source file (SimpleExtension.swift) that illustrates key features such as exposing classes like RigidBody2D and Sprite2D, using @Export for properties (including TypedArray and resource types), defining @Signal and @Callable methods, and interacting with Godot's Variant system and project settings.

Sources/SimpleExtension · high confidence

Add Swift Package Manager plugin for generating Godot entry points

A new Swift Package Manager build tool plugin has been added to automatically generate a Godot entry point file. When integrated into a package, this plugin scans the target's source files and invokes the \EntryPointGenerator\ tool to produce a \EntryPoint.generated.swift\ file in the plugin work directory, streamlining the setup of Godot applications built with Swift.

Plugins/EntryPointGeneratorPlugin · high confidence

Added ManualExtension example demonstrating custom class registration

A new example extension has been added to demonstrate how to manually register custom Godot classes, properties, and methods in Swift. This includes a \SwiftSprite\ class that exposes a \demo\_favorite\_food\ property and associated methods via manual \ClassInfo\ registration, alongside a \Rigid\ class, providing a reference for complex extension setups beyond the simpler \SimpleExtension\.

Sources/ManualExtension · high confidence

Automated test suite discovery via build-time code generation

The TestSuiteGenerator plugin and its underlying command-line tool now automatically scan source files for classes annotated with the @SwiftGodotTestSuite macro during the build process. This eliminates the need for manual registration of test suites, as the generator produces a Swift file that populates the TestRunnerNode.generatedSuites array with all discovered suites, ensuring deterministic output through sorted naming.

Plugins/TestSuiteGeneratorPlugin, Sources/TestSuiteGenerator · high confidence

Initial repository structure and documentation for SwiftGodot

This change establishes the foundational structure of the SwiftGodot project by adding essential configuration and documentation files. It introduces a \.gitignore\ to exclude build artifacts and IDE files, a \.spi.yml\ to configure the Swift Package Index documentation builder for the SwiftGodot and ExtensionApi targets, and a \.swiftlint.yml\ to enforce code style rules. Additionally, it adds a \Makefile\ with targets for building documentation, previewing it locally, and generating binary artifacts, alongside comprehensive documentation files (\README.md\, \BINARY\_RELEASES.md\, \TESTING.md\, \WINDOWS\_BUILD.md\) that explain how to consume the library, build for various platforms including Windows, and run tests. A \LICENSE\ file is also added under the MIT license.

(repo-wide) · high confidence

Introduce SwiftGodotTestSuite macro for automatic test discovery

Developers can now use the @SwiftGodotTestSuite macro on test classes to automatically generate test invocations. The macro adds conformance to SwiftGodotTestSuiteProtocol and creates an allTests property containing every method starting with 'test' that takes no arguments and returns void, simplifying the setup for running SwiftGodot tests.

Sources/SwiftGodotTestMacros, Sources/SwiftGodotTestMacrosLibrary · high confidence

New @Rpc macro, editor plugin helpers, and arithmetic compatibility fixes

SwiftGodot now includes an @Rpc macro to configure Godot multiplayer RPC settings (mode, transfer mode, etc.) for callable methods, and exposes editorAddPlugin/editorRemovePlugin functions to manage editor plugins from Swift. Additionally, arithmetic compatibility extensions are added for Vector2/3/4, Color, and their integer variants to support multiplication and division by Int, bridging the gap caused by generated builtins exposing Int64/Double scalars.

Sources/SwiftGodot · high confidence

New Swift-based test runner for end-to-end testing

A new Swift command-line tool (SwiftGodotTestRunner) has been added to automate the end-to-end testing workflow. This tool builds the SwiftGodot test extension and runtime libraries, copies them into the Godot test project, and launches the Godot executable to run the tests. It includes logic to locate executables on Windows and Unix-like systems, handles platform-specific library paths, and parses JSON test results to report pass/fail status.

Sources/SwiftGodotTestRunner · high confidence

New SwiftGodot documentation site

The SwiftGodot documentation has been reorganized into a new DocC-based site, providing comprehensive guides for developers. Key topics include using the @Node macro for referencing scene nodes, creating and registering custom Godot types, exporting properties with @Export, defining and connecting signals, and configuring remote procedure calls with @Rpc. The documentation also covers platform-specific integration such as debugging in Xcode, running code in the Godot editor, hosting Godot in SwiftUI, and memory management rules for different object types.

Sources/SwiftGodot/SwiftGodot.docc · high confidence

New SwiftGodot tutorials for macOS and Swift Package Manager

The documentation now includes a new main-level tutorial and updated starter code for building SwiftGodot applications. The tutorials demonstrate how to create a simple runner game using the @Godot and @Node macros, handle player movement with \_physicsProcess, and manage scene nodes. Additionally, the Swift Package Manager (SPM) integration guide has been updated to target macOS 14 and shows how to configure a Swift package to depend on SwiftGodot, including setting up dynamic libraries and entry points for GDExtension.

Sources/SwiftGodot/SwiftGodot.docc/Resources/Tutorials · high confidence

New SwiftGodotKit and Extension tutorials

Added documentation tutorials for integrating SwiftGodot into macOS applications. The 'Using SwiftGodotKit' tutorial guides users through setting up a command-line tool in Xcode, adding the SwiftGodotKit package dependency, and configuring signing capabilities to run Godot entirely from Swift. The 'Your First Extension' and 'Writing Multiple Scripts' tutorials provide step-by-step instructions for creating a Swift package that extends Godot, including building a player controller, handling signals, and registering custom node types with the engine.

Sources/SwiftGodot/SwiftGodot.docc/Tutorials · high confidence

New entry point generator plugin with verbose logging

A new command-line tool, EntryPointGenerator, has been added to scan source files for classes marked with the @Godot macro and automatically generate the corresponding Swift entry point registration code. The tool accepts source files as arguments and outputs the generated registration file, and it now includes a verbose mode (disabled by default) that provides detailed logging of the scanning process and classes found.

Sources/EntryPointGenerator · high confidence

New scripts to build and distribute prebuilt SwiftGodot binary packages

The repository now includes a suite of build and packaging scripts that produce prebuilt XCFrameworks for SwiftGodot, SwiftGodotRuntime, and GDExtension, along with a precompiled SwiftGodotMacroPlugin. This allows consumers to use SwiftGodot via Swift Package Manager without needing to compile the engine or resolve the swift-syntax dependency. The workflow builds the macro plugin and engine binaries for macOS (Apple Silicon and Intel) and iOS (device and simulator), packages them into an XCFramework, and generates a validated SwiftPM package structure with correct checksums for release.

scripts · high confidence

New utility extensions for GD, Node binding, and physics raycasting

This update adds several new extension methods to the SwiftGodot API. It introduces a \@BindNode\ property wrapper for \Node\ subclasses, allowing developers to automatically reference scene nodes by name or custom path with optional caching, while recommending \SceneTree\ for nullable/dynamic cases. It also adds \GD.load\ convenience methods for loading resources with reuse caching and a \GD.printDebug\ helper that prints to the console only in debug builds. Additionally, \PhysicsDirectSpaceState2D\ and \PhysicsDirectSpaceState3D\ now provide typed \intersectRay\ methods that return structured \IntersectRayResult\ objects (including position, normal, collider, and metadata), replacing the previous raw dictionary returns. Finally, \SceneTree\ and \ProjectSettings\ gain \createFrom(nativeHandle:)\ static methods to support embedding scenarios.

Sources/SwiftGodot/Extensions · high confidence

SwiftGodot macro library initial implementation

The SwiftGodotMacroLibrary source files are introduced, providing the compiler plugin that generates the Swift bindings for Godot. This includes macros for marking classes (@Godot), exporting properties (@Export), defining callable methods (@Callable), registering signals (@Signal), and handling RPCs (@Rpc), along with supporting macros for scene tree node access (@SceneTree), texture loading (@TextureLiteral), and enum naming (@PickerNameProvider). The library also adds the InitSwiftExtension macro for module initialization and a CodePrinter utility for code generation.

Sources/SwiftGodotMacroLibrary · high confidence

SwiftGodot runtime adds convenience extensions for vectors, callables, and editor property registration

The SwiftGodot runtime library introduces a suite of convenience extensions in the \Extensions\ directory to improve developer experience and editor integration. Arithmetic operations are now supported for Godot vector types (\Vector2i\, \Vector3i\, \Vector4i\, \Vector2\, \Vector3\, \Vector4\) and \Quaternion\/\Color\, including integer scaling and prefix negation. \Callable\ objects can now be initialized directly from Swift closures, allowing for more natural callback definitions. Editor integration is enhanced with \ClassInfo\ methods to register checkboxes, enumerations, and file pickers (including macOS \UTType\ support) as properties. Additionally, \VariantArray\ and \VariantDictionary\ gain typed initializers, subscript access, and debug descriptions, while \GD\ provides variadic utility functions for printing and error logging.

Sources/SwiftGodotRuntime/Extensions · high confidence

Behavioural changes

7 commits (1 fix) modifying Testbed/bin

A change to existing behaviour in Testbed/bin — 7 commits (1 fix), 1 file.

Testbed/bin · medium confidence · unverified

Add Singleton support

The SwiftGodotEditorExtension now includes support for singletons, as indicated by the addition of the EditorExtensionMain.swift file and the GodotEditor.gdextension configuration file. This change enables the extension to manage singleton instances within the Godot editor environment.

Sources/SwiftGodotEditorExtension · medium confidence

CodeGeneratorPlugin now supports combined output and conditional static cache enforcement

The plugin now generates combined source files (e.g., SwiftGodotA.swift) on Windows and optionally elsewhere to reduce file counts and prevent build performance issues, while also enforcing that the staticCachesOnMacOS configuration requires the with\_multi\_process trait to avoid runtime crashes.

Plugins/CodeGeneratorPlugin · high confidence

Enhanced @Callable and @Export macro support for enums, closures, and default arguments

The SwiftGodot runtime's macro integration now provides deeper interoperability with Godot's type system. @Callable methods can now accept and return enumeration values (with proper metadata for editor visibility), use closures as parameters, and define default arguments. Additionally, @Export properties receive improved automatic hints and support for setting closure values, ensuring that Swift types like enums and optionals are correctly exposed and handled within the Godot editor and documentation.

Sources/SwiftGodotRuntime/MacroIntegration · high confidence

Generator overhaul: new file structure and enhanced default value handling

The Generator module has been restructured into distinct source files (Arguments, BuiltinGen, ClassGen, Data, DocModel, Enums, GenerationSettings, MethodGen) to improve organization and maintainability. A key behavioral change is the expanded support for default argument values in generated code, now correctly handling empty TypedArrays, empty Dictionaries, and OptionSets (bitfields) in addition to standard types. The generator also introduces a new \Data\ initializer to work around a Swift 5.10 on Windows bug with \init(contentsOf:)\, and adds stricter validation for missing reference types during generation to prevent silent API degradation.

Generator/Generator · high confidence

SwiftGodot Runtime Core: New argument handling, bridging, and editor integration

The SwiftGodot runtime core has been significantly refactored to improve stability, performance, and editor integration. A new \Arguments\ struct replaces previous argument marshalling, providing safer, non-copyable storage for \Variant\ sequences and throwing \ArgumentAccessError\ instead of crashing on out-of-bounds access. Method and signal registration now utilizes \FastFunctionBridging\ and \ClassServices\ with support for default arguments and improved property info handling. Editor documentation can now be loaded at runtime via \EditorInterop\, and new protocols like \GodotBuiltinConvertible\ allow custom types to be exposed as specific Godot builtins (e.g., \TypedArray\) rather than generic \Variant\. Additionally, \FastStringName\ optimizes string name creation using \StaticString\ to reduce allocations, and \ObjectCollection\ is deprecated in favor of \TypedArray\.

Sources/SwiftGodotRuntime/Core · high confidence

SwiftGodot runtime stability and compatibility improvements

The SwiftGodot runtime now handles Windows shutdown more reliably by pinning Swift and Foundation DLLs to prevent deadlocks during process termination. It also fixes a bug where a stale Godot library pointer would persist after an extension is unloaded and reloaded, ensuring correct behavior during reload cycles. Additionally, the runtime now supports older Godot versions (such as 4.2) by adding fallbacks for missing APIs and making certain methods optional, and it improves Variant handling by returning nil for nil results in subscripts and accepting nil on assignment.

Sources/SwiftGodotRuntime · high confidence

Testbed updated to Godot 4.3 with new demo content

The Testbed project has been upgraded to target Godot 4.3 (previously 4.0) and sets a compatibility minimum of 4.2 for its extension. The main scene now includes additional demo nodes, specifically a 'Rigid' node with a 'CollisionShape2D' using a new CircleShape2D resource, alongside existing Example and Button nodes. The extension library binary has been renamed from 'SwiftGodot' to 'SimpleExtension' for both debug and release builds. Additionally, a shader global for a heightmap texture has been added to the project rendering settings.

Testbed · high confidence

Update Extension API to Godot 4.7

The Extension API module has been updated to support Godot Engine v4.7.stable.official. This change includes a regenerated \extension\_api.json\ data file reflecting the new engine version, along with corresponding Swift model types in \ApiJsonModel.swift\ and manual extensions in \ApiJsonModel+Extra.swift\ to ensure the API models remain compatible with the updated metadata structure.

Sources/ExtensionApi · high confidence

Fixes

Add TestEditor project configuration for Godot 4.2

A new project configuration file (project.godot) has been added to the TestEditor directory, establishing the environment for the Godot 4.2 engine with Forward Plus rendering. This configuration sets the main scene to res://node\_2d.tscn, defines the project name as "Sample", and enables ETC2/ASTC VRAM compression for textures.

TestEditor · high confidence

Test coverage

Added compile-time regression tests for arithmetic ambiguity and MainLoop casting; Added empty test file for SampleLink; Added macro expansion tests for SwiftGodot macros; Added test resources for SwiftGodot macro code generation; Added unit tests for SwiftGodot math types; Added unit tests for memory layout and runtime module lookup; Expanded test coverage for SwiftGodot built-in types and runtime features; Test project now runs as a GDExtension with clean unload orchestration.

Dependencies

SwiftGodot package dependencies and build configuration

The SwiftGodot package now depends on swift-argument-parser (from version 1.3.0) and swift-syntax (version 603.0.2). The build system supports using a precompiled binary version of swift-syntax via the swift-precompiled repository, and includes build switches for vendored module names, prepared generators, and stable interface emission to support various distribution and integration scenarios.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 58 → 51 (-7.5)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 93 → 83 (-10.1)
  • Architecture 91 → 90 (-0.5)
  • Maturity 58 → 56 (-1.2)
  • Readiness 50 → 35 (-14.3)
  • Security 57 → 57 (+0.0)
  • Domain Modelling 86 → 86 (+0.0)
  • Performance 78 (new)

Resolved (9)

  • Documentation: no architecture or design documentation (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (16–18 lines × 2) (Plugins/EntryPointGeneratorPlugin/EntryPointGeneratorPlugin.swift)
  • Duplicated block (8–12 lines × 2) (Plugins/EntryPointGeneratorPlugin/EntryPointGeneratorPlugin.swift)
  • Hotspot: Sources/SwiftGodotTestRunner/SwiftGodotTestRunner.swift (Sources/SwiftGodotTestRunner/SwiftGodotTestRunner.swift)
  • Low cohesion: Wrapped (LCOM4 8) (Sources/SwiftGodotRuntime/Core/Wrapped.swift)
  • Off-boarding risk: anonymized user #1
  • Test project verifies nothing: SwiftGodotUniversalTests (Tests/SwiftGodotUniversalTests/MemoryLayoutTests.swift)

New (61)

  • Arguments.swift.getArgumentDeclaration (cognitive 110) (Generator/Generator/Arguments.swift)
  • Arguments.swift.getArgumentDeclaration (cyclomatic 48) (Generator/Generator/Arguments.swift)
  • BuiltinGen.swift.generateBuiltinClasses (cognitive 86) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinClasses (cyclomatic 57) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinCtors (cognitive 59) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinCtors (cyclomatic 30) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinMethods (cognitive 44) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinMethods (cyclomatic 25) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinOperators (cognitive 45) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateBuiltinOperators (cyclomatic 18) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateMethodCall (cognitive 30) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.generateMethodCall (cyclomatic 17) (Generator/Generator/BuiltinGen.swift)
  • BuiltinGen.swift.getInitializer (cognitive 29) (Generator/Generator/BuiltinGen.swift)
  • ClassGen.swift.generateProperties (cognitive 65) (Generator/Generator/ClassGen.swift)
  • ClassGen.swift.generateProperties (cyclomatic 32) (Generator/Generator/ClassGen.swift)
  • ClassGen.swift.generateVirtualProxy (cognitive 69) (Generator/Generator/ClassGen.swift)
  • ClassGen.swift.generateVirtualProxy (cyclomatic 40) (Generator/Generator/ClassGen.swift)
  • ClassGen.swift.processClass (cognitive 37) (Generator/Generator/ClassGen.swift)
  • ClassGen.swift.processClass (cyclomatic 29) (Generator/Generator/ClassGen.swift)
  • Coverage not measured — Swift suite
  • …and 41 more

Changes since last survey

  • 14 commits — 14 feature/other, 0 fixes

By area

  • (root) — 3 commits
  • Generator/Generator — 3 commits
  • Sources/SwiftGodotRuntime — 3 commits
  • Sources/SwiftGodot — 2 commits
  • Plugins/CodeGeneratorPlugin — 1 commit
  • Sources/ExtensionApi — 1 commit
  • Tests/SwiftGodotMacrosTests — 1 commit

Notable commits

  • change: Add docs on SwiftUI hosting
  • change: Bump to the Godot 4.7 API
  • change: CI and README: Godot 4.7
  • change: CodeGeneratorPlugin: prepared generator, extra-classes.txt, static-cache flag
  • change: CodeGeneratorPlugin: refuse staticCachesOnMacOS without the with_multi_process trait
  • change: Generator: safe enum returns, cached singletons, optional macOS static caches
  • change: Keep the runtime working on Godot 4.6 with 4.7 bindings
  • change: Keep vector * Int compiling now that builtins expose Int64 and Double scalars
  • change: Macro: separate letters from digits in virtual method names
  • change: Multi-instance runtime improvements from the Xogot tree
  • change: Package.swift: build switches for vendored copies
  • change: Runtime: derive module names at runtime instead of hard-coding SwiftGodot
  • change: Surface the classes new in Godot 4.7
  • change: Variant subscript returns nil for a nil result and accepts nil on assignment

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

migueldeicaza/SwiftGodot was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit c3303eadffe4413eaab359983ff7cd759fd7f351 — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.