Sponsored By

Playdate games can now be written in Swift

New embedded language support means Swift developers can try their hands at making games for Panic's handheld.

Justin Carter, Contributing Editor

March 12, 2024

1 Min Read
Screenshot of Panic Inc.'s Playdate handheld.
Image via Panic Inc.

At a Glance

  • Swift being brought into Playdate's fold may may allow Apple developers to experiment with making unique games for Playdate.

Developers can now use the Apple-developed Swift coding language to make games for the Playdate handheld after its developers rolled out new support for embedded language modes.

As explained by Apple developer Rauhul Varma, Swift's new mode was specifically meant for "highly constrained platforms." While it uses more generic specialization, the mode retains Swift's core features.

The support is "actively evolving," and Varma claims the embedded language works as a "great solution for shrinking Swift to fit the Playdate’s constraints."

Most Playdate games are made with Lua, explained Varma, which is easier from a development standpoint. The ease is contrasted by performance issues that make a Playdate game often exceed its already light limits.

Swift support expands who can make games for Playdate

To demonstrate, he wrote two games in Swift. One clocked in at 788 bytes, smaller than a regular Playdate game made with C and clocking in at 904 bytes.

The second game, Swift Break, uses high-level language features found in desktop apps. But those were all simplified during development while still having the performance of a C-made game.

In making Swift Break, Varma wanted Swift to build upon Playdate's C SDK. His full breakdown covers a step-by-step process on making object files for the Playdate Simulator, and importing its C API to create the game and then build upon it.

While there was "no shortage of challenges," he encouraged developers to try their own hands at making Swift projects for Playdate.

"Enjoy a development experience with Swift that is both expressive and performant," he wrote. "I hope this post encourages you to explore the possibilities of using Swift in unconventional environments."

About the Author

Justin Carter

Contributing Editor, GameDeveloper.com

A Kansas City, MO native, Justin Carter has written for numerous sites including IGN, Polygon, and SyFy Wire. In addition to Game Developer, his writing can be found at io9 over on Gizmodo. Don't ask him about how much gum he's had, because the answer will be more than he's willing to admit.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like