A scripting Swift IDE prototype (demo video)

I love Swift for iOS and macOS apps and I want to use it for everything else on my Mac. So I made a prototype that I call "Swift Light":

I posted a demo video here » https://underplot.com/light

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! :tada:


Press X to Doubt :P

But seriously, this looks cool. It's seems two steps away from being a modern day Hypercard.


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?


Is it wrong that I’m hoping Apple sherlocks this for the next version of Automator?

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 :thinking:

1 Like

Apple has their own priorities, not sure if this kind of scripting is one of them...

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 :man_shrugging:

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.

But yeah, looks really nice :+1:


Looks real nice. Currently I use Coderunner to run my swift scripts, it works pretty well, but a dedicated UI would be even cooler.

1 Like
Terms of Service

Privacy Policy

Cookie Policy