Let me preface this by saying that this is not really a criticism of Swift. I started experimenting with the language a few months ago and I absolutely loved most things about it.
However, I came across a few issues which made me lose interest in continuing my project in Swift, and went back to the previous language I was using. However, if there were workaround for these issues then I'd definitely reconsider using swift for that project.
For some background, I'm working on a somewhat low level (for now) - code first game framework. I'm implementing it in the Beef programming language.
I'm mostly satisfied with what Beef offers, but have some concerns. It's mostly developed by a single person. Having a bus factor of 1 is risky IMO. The ecosystem is also immature at the moment. I've had to create my own bindings for all the low level libraries that I wanted to use (win32, SDL, Vulkan, dx11/dx12, OpenGL, OpenGL, spirv stuff, glslang, detex, among others.
Reasons I looked at swift include the advertised C and C++ interoperability, recent improvements in windows support, and I don't think swift will be disappearing or that development will languish any time soon.
I tried porting the core parts of my existing work so far in Beef. Going in, I expected some productivity loss since I'm just learning the language. However, it was more than I bargained for.
The first problem is that compile times are bad... I mean really bad compared to what I was getting with Beef.
Now I don't know if this just happens with the tooling on Windows, or if there is a problem with my setup, or how I've configured my project (maybe someone could say? GitHub - jayrulez/sedulous-swift: Sedulous, but in Swift). Making small changes and watching the project take multiple seconds to compile is . In Beef, I get near instant compilation for similar changes.
Is this normal?
Next problem is with bindings to C libraries. It's great that I can include a C header in my build pipeline... But I want to work in idiomatic Swift. Code made available from C headers is not that. There doesn't seem to be a way to declare a struct/enum/union in Swift that is C compatible. Beef has an annotation (CRepr) and I believe Rust has something similar that tells the compiler to treat the type like its C counterpart in memory. I'd like to build these external libs outside of my swift project build system, then just link a .lib or .DLL/.so/dylib, and declare the required types for Interop in Swift. There's a way to link to external functions but I was advised to not depend on it, because it's not part of the public API (@_extern IIRC).
Also, the tooling seems finicky when it comes to these bindings I've added for Swift so far (Vulkan, sdl2). Half the time, autocomplete for the Interop types doesn't work. When it does, it's mostly delayed. Sometimes I have to restart VSCODE to get it to work. Again, I don't know if I have a broken setup here.
Additionally, there aren't as many low level bindings (at least for the domain I'm working in) available as I thought there would be for a language as popular as Swift. I won't complain about that too much though, because at least I can provide my own.
Does anyone else have this kind of experience with Swift? Especially the slow compile times?
I'd love if there were solutions or alternative approaches that would allow me to continue working in swift without the productivity loss.