Redesigning an API – Swift 2.0 style

SwiftShell (an OS X framework for shell scripting in Swift) is currently using the |> operator to combine shell commands, streams and functions, and |>> to print the results:

But Swift 2.0 is here, and it’s clear the way forward is protocols, method chaining and error handling. And being more explicit about what is going on. So for SwiftShell 2 I’m planning something like this:

And this (listing all executables available in PATH):

Maybe SwiftShell 1 looks cooler ( |> is after all very cool), but I think SwiftShell 2 is cleaner and shows more clearly what’s going to happen. It also makes it easier to take advantage of the Swift standard library, and most importantly is more in keeping with the spirit of Swift 2.0.