Server-Side Swift Live Coding

Introduction is a website where you can experiment with NSDateFormatter live. Here, I’ll create a website where you can experiment with server-side Swift live.

Sites I’ve created that allowed live experimentation included:

Get more development news like this


There are many server-side frameworks written in Swift. For this demonstration, I will use Vapor. I will use Xcode to write the app, mainly for its auto-completion, and I will run it on Docker.

We’ll make a simple app that shows a live demonstration of the string upper case method using a template from Vapor (see the video for the source code). We create the root GET request, handle the input JSON, and then the POST request. Lastly, we write a test converting the input to and uppercase string; this will be our template.

Creating the Actual App

First, we create a project from the template, and open it in Xcode. We edit the PackageDescription file, by adding the dependencies, which can be seen here:

In the Example Model, when we import the KituraMarkdown file, the output will be KituraMarkdown.render(from: input). Then, we can write the tests to verify that the live changes are correct.

Next Up: Super Spectacular Server-Side Swift!

General link arrow white

Tatsuya Tobioka

Tatsuya is a Swift developer from Japan. He maintains his portfolio of work at

Transcribed by Sandra Sanchez-Roige