Server-Side Swift

There has been a lot of buzz around bringing Swift to the server and use it on the web. Lately the Swift team assigned a work group responsible for the Server APIs Project pushing even further this idea.

The first question is why? After all we have great tools in this field, Ruby on RailsSpring, Laravel, etc.

The main arguments are that Swift:

  • is fast, compared to Ruby for example;
  • is a safe language, since it is strongly typed;
  • it is more expressive than Java or C#;

We don’t know if these are enough strong or valid motives to reinvent the wheel. For us the main motive as an iOS Developer is to Build end-to-end applications in Swift. Nevertheless we decided to make a spike exploring how it is to develop an API using  Swift.

The largest Server Side Swift frameworks are:

  1. Perfect (~9.2K stars)
  2. Vapor (~7.2K stars)
  3. IBM Kitura (~4.8K stars)
  4. Zewo (~1.4K stars)

After watching Session 415 from WWDC 16, Going Server-side with Swift Open Source, we decided to try Kitura from IBM.

The provided Getting Started is fairly simple to follow, where you end up with a “Hello, World!” that responds on http://localhost:8090

You can deploy the application into Bluemix and for doing the deploy and provisioning it’s possible to use the macOS app IBM Cloud Tools for Swift.

Here is the macOS app with one Server Repository, one Cloud Runtime, and one cliente iOS App.


We use the same workspace for both the Server and iOS application using the following guide.

The sample project we did was very simple, the server expose a route with a static JSON and the application read from it. The nice thing about having the Server code and the iOS application is that you can work on it at the same time and reuse code between them.


The project is available at our GitHub.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s