Skip to main content

Mike Kreuzer

Swift scripts

29 October 2014

Swift is a beautiful language for writing apps, but for scripting it's not quite there yet.

There are just a few too many missing pieces to the puzzle. Playing around with Markingbird (a Swift Markdown processor) and Stencil (a moustache-like template engine) I soon ran up against the need to start writing Swift wrappers and bridges for libYAML, libSass, and for some reason NSRegularExpression.regularExpressionWithPattern(etc) started inexplicably failing too… possibly there's been some change in the language or libraries there, possibly that's just a bug.

My feeling is that sort of thing is going to be the experience when using Swift for anything but the smallest of scripting tasks for the next little while. The libraries just aren't available in a format where using them's easy enough to bother with.

Writing swift scriptname.swift into the terminal is a whole lot better than xcrun whatever it was we used to have to type though, so small steps. And as Stencil and projects like it show, people are filling in the missing pieces. So one day soon, fingers crossed.

This post marks the start of an experiment in more short form and also more regular writing. Pump up the volume!