Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Quick question: Does it mean now we can write games on Windows using SDL + Swift, and it will run on MacOS without any change at all?


There's libraries which wrap SDL for Swift and run on Mac, iOS and Linux. Someone should help them to get support for Windows.

This project has a good list of SDL Swift libraries at the end of the page: https://github.com/ctreffs/SwiftSDL2 - but I don't know which one is the best one..

Then, we need to get Swift to compile for Android..


Quick answer: no.


Could you please explain why?


No OP, and I don't know much about game development, but "without any change at all" is too strong. SDL only does so much, and you still need platform-specific APIs for file access, networking (if applicable), threading, etc. So you'll still need platform-specific code until someone writes those abstractions in Swift.


> SDL only does so much, and you still need platform-specific APIs for file access, networking (if applicable), threading, etc. So you'll still need platform-specific code until someone writes those abstractions in Swift.

Isn't that handled by the swift runtime?

By without any changes I meant, without platform-specific recompilation. Very similar to what java runtime provides for JAR.


You'll always need platform-specific recompilation for native executables, as the executable formats are different on different operating systems. The only exceptions are emulation systems like WSL and Wine.


I should have added it to my first post - SDL provides precompiles libraries for different platforms. All I have to do is to distribute them with my game. Does it solve the problem?


Swift Foundation is cross platform and provided by apple


Ah, that's great! I didn't realize Apple open sourced Foundation as well.


not OP either. but i think the problem is simple. apple said no to opengl, which any other platform out there supports.

btw, they are even deprecating opengl! i have no idea what that means for the tons of games written with an opengl backend. probably not an issue for the iOS ecosystem though.

so that's what is going on...


OpenGL isn't relevant here, as SDL2 has a metal backend that's used by default on MacOS. See https://hg.libsdl.org/SDL/rev/1acae5590352


> OpenGL isn't relevant here

oh nice, i had no idea SDL had metal support!

no one in the SDL developer community tells you how to support metal or how to use it. instructions for MacOSX redirects you to another library, which has since removed their instructions.

who exactly are we kidding here?



Why would you want an old API like OpenGL when you can use Vulkan and Metal


And in case anybody comes in raving about how Vulkan isn't supported on macOS, that's fine, Vulkan-to-Metal compatibility layer libraries are available.


Well, Vulkan is also not supported on PlayStation, XBox, Win32 and UWP sandboxes, Android devices until Android 7, and until version 10 only flagship devices actually had any kind of proper support.


Two very different technology stacks and api calls.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: