Reality Vs Reality

I think it's good to keep Swift as non-Apple-centric as possible; it's a good language with a lot of neat features and a simple, clean syntax.

Meanwhile, developing on Apple platforms is truly a joyless experience. Everything is so locked-down that you can't just start with an idea in the morning and hack together a prototype by the afternoon.

Today, for example - I wanted to write a key-mapper for MFI gamepads (since OSX now supports PS4 controllers). I thought it would be easy; just listen for events using the GameController framework and send the mapped keyboard/mouse events in response. Except that you only get access to those controllers if your App is sandboxed, and if it has the appropriate entitlements (something that Apple apparently forgot to document). GUI applications won't receive updates if they're not in the foreground, so that's no good, and getting a sandboxed CLI application set up with an Info.plist is incredibly frustrating (_libsecinit_appsandbox just crashes with no message, and the Console output has all possibly-useful information masked out). Maybe I could find another workaround - spawning a thread from the GUI app or using an XPC service or something, but by this point I've spent half a day fighting the system and my enthusiasm for the project has all but been drained.

All of this is to say: Swift is a really nice language, and if anything it is held back by how difficult it has become in recent years to write applications for Apple's platforms. Whenever I have a little project like the one I described, I would happily use Swift to implement it - but I hesitate whenever that means touching an Apple system framework, because that often means you should expect some pain.

I'm really hoping for a stable WASM port in the near future. I think Swift would be a much nicer alternative than C/C++/Rust for people who are currently writing Javascript, and a user-base of that size could help to dilute how Apple-centric the language currently is in practice.

1 Like