This is not an Xcode alternative — Xcode is obviously aready really good at what it does, also it's first-party and it's free.
Swift Light is an alternative of you having to use scripts from the command line and fall back on weird languages to do so. It could be really good for local automation, experiments, and highly specialized computations like statistical work, graphing, and more.
Please let me know what you think once you've watched the video, I'm curious to get everyone's thoughts!
I like that modifying main's return type modifies the result type in
the sidebar. Do you use SourceKit to fetch the return type?
I am curious about the implementation. Do you compile the program to
an executable, run it, and capture the output? Or do you compile the
program to a loadable object, load the object, look up symbol main,
call it, and use the return value?
To access the toolchain, does Swift Light need to run with a lightly
restricted privilege set?
Yeah, I have a very simple visitor that grabs all the details of the main function and rebuilds the IDE UI dynamically. Regarding the execution - I've considered both approaches. Currently I'm not concerned with performance so I'm compiling and running a binary to capture the output but of course it'll be much more neat to compile, dlopen and invoke main - the issue is if main's signature is different each time you dlopen, how do you invoke it
This looks nice; I would use something like this, for sure.
Currently if I need to run a code snippet, I use Xcode Playgrounds, but they're really unstable. They start off working as you'd expect, but after a while they just stop executing no matter how many times you click the "play" button
One thing that would be nice is package support. We've talked about adding this to Swift scripts in the past, but as of now nothing has landed AFAIK.
Also, I noticed that the code-completion popup doesn't include documentation snippets. That would be another nice thing to add, together with Xcode-style quick help popups or some kind of documentation viewer sidebar.
this looks really interesting, any plans to support linux? i suspect this is where you will find most of your audience, since we don’t really have a lot of good editors for swift on linux
I've done plenty of Swift for Linux on my mac via Docker and that worked fine for me so I'm honestly wondering how big of an audience are we talking about? I haven't read much about Linux on the desktop for a while so I'm not sure if there is a real customer pool to develop for?