March 24, 2026

Swift wars: web builds and wounded pride

Testing the Swift C compatibility with Raylib (+WASM)

Swift game demo ignites brawl over speed, “easy‑mode,” and Apple pain

TLDR: A developer showed Swift running a simple raylib game on macOS and the web, proving easy C-library hookups without hand-written glue. Commenters split over real-world value—some call it “easy-mode,” others question web build size and speed, and many gripe that Apple’s slow compile times spoil the party.

A tiny Swift demo using the C-based raylib engine just lit up the comments. The author claims Swift can talk to C without messy “FFI” (foreign function glue) thanks to Apple’s Clang importer—drop in headers, link the library, and boom: a window and “It’s alive!” on macOS and a web build via WebAssembly (WASM). No tutorials, just a proof that Swift isn’t only for iPhones.

The crowd split fast. Performance hawks asked whether Swift adds size or slowness compared to plain C compiled with Emscripten—translation: does this web build bloat? Another voice waved off the win entirely, calling this “easy-mode” because raylib’s C API is friendly in pretty much any language. Meanwhile, a veteran grumbled that the real pain starts when you need “advanced” game features—pathfinding, model loading, UI toolkits—and that Swift’s ecosystem still feels thin there. Then came the mic drop: compile times. One commenter blasted Apple for “abysmal” build speeds, arguing similar languages deliver the same vibes without the waiting.

In short: one neat demo, four different fights. Is Swift secretly great at C interop? Yes, say fans. Does it matter if the web build’s heavy, C++ interop is the real test, or Apple builds are slow? That’s where the drama lives.

Key Points

  • The author demonstrates building a basic Raylib game in Swift for macOS and the web using WASI.
  • Swift’s Clang importer enables automatic C interop, avoiding manual FFI bindings or wrappers.
  • Project structure separates CRaylib (C headers and platform-specific static libraries) from MyGame (Swift code).
  • Package.swift configures a target for Raylib and sets linker settings, including macOS-specific frameworks like OpenGL.
  • The author vendors Raylib headers and static libraries directly into the repository to ensure reliability and avoid dependency issues.

Hottest takes

"Raylib has a C API though, and this is 'easy-mode' in any language" — flohofwoe
"how much overhead does the choice to use Swift add here or in general?" — keldaris
"Apple won't fix Swift's abysmal compile times" — leecommamichael
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.