Swift for Playdate

The Swift team's newly-announced embedded language support means you can now write Playdate games in Swift—it's expressive and performant. Read more about it on the Swift blog:

20 Likes

Awesome! Was this coordinated at all? Meaning, is Panic going to check compatibility with Swift programs in future SDK updates, or is that up to the Swift team? For example, something like SDK 2.0 that broke Rust support - I'd love to see Panic help prevent things like that.

3 Likes

This is super exciting, and makes me want to re-write my game IMMEDIATELY. :joy:

1 Like

This was not coordinated. This is more of a proof of concept created by the Swift team which we hope the community will pick up (with forks already created) and flush out. We hope to be able to provide some assistance and contribute to the overlay, but we don't have the bandwidth to drive the effort completely.

7 Likes

This is great news! I'm having a tough time learning C but already know Swift and would love to just be able to code in Swift. Hope this pans out, I have some cool ideas I want to build for the Playdate but having to learn C is a major hurdle (Lua is too slow) - this would be the absolute best improvement possible to the Playdate dev experience imo

A friend sent this to me wondering if this would help move the Playdate SDK over to Swift more efficiently. Perhaps. Thought I'd share.

We're planning to have a community-maintained one soon! Currently we have one from Jackson at GitHub - jackson-57/playdate-swift-overlay: An expanded overlay for Swift development on Playdate, but depending on its development compared to Finn Vorrhees's PlaydateKit (GitHub - finnvoor/PlaydateKit), we may have it moved to our newly created organization at Playdate Squad · GitHub.

4 Likes

Hi! Is it possible to use the swift porting for windows as well?

Yes, you should be able to build on Windows as well.

1 Like

I've found a few quirks and oddities that make development on Windows a little more tricky:

  • When using PlaydateKit (see GitHub - finnvoor/PlaydateKit: Create games for Playdate using Swift.), the PDC plugin does assume that you're using a Mac, as I could not get this running under Windows sufficiently.
  • For C games, it appears that CMake is currently the only supported build system mechanism on Windows for Playdate. I mention this because earlier iterations of Swift on Playdate relied on Make, which isn't supported. I tried this approach as well, with limited success; likewise, I also tried to convert a sample project to using CMake instead of Make, but I couldn't quite make heads or tails of it.
  • What I did get to work was using a Linux distribution via WSL and running the project through there. I did have to change some bits of code and Make files around to point to the Linux tool chains instead of Mac, but I can at least build and deploy to a real device. The simulator builds are more difficult because the linker flag -exported_symbol doesn't exist on Linux (I presume this is Mac only, as I didn't find any documentation online).

I think that, as of right now, there's definitely room for improvement on the Windows front. Currently, the tool chains are very much slanted towards macOS (and Linux, to some degree).

Will this mean that we need to pay 30% to Apple?

While Apple is the primary contributor to the Swift programming language, it is open source and available for various platforms. So, no, you don't need to pay Apple a dime to use the Swift programming language.

2 Likes

Does the debugger work?

2 Likes