Why Server-Side Swift Adds a New Dimension

To what you can build yourself as an iOS Developer

Server-side Swift, in my opinion, is not just another option for your web server alongside Ruby on Rails, PHP Symfony, Node.js and the hundreds of others. It really adds a lot of power to you as an iOS or macOS developer because you can create so much more experiences only by yourself — which is how most of your ventures get started if you’re like me.

What it is all about: Creating Something Awesome

At least that’s the key element for me. The moment when people use something you’ve been working on — whatever it is — and think ‘wow, how did you do that?’ — that’s when they are inspired to create something they’re proud of, too. That’s when it was worth all of your time and energy.

And while it’s clearly possible to create amazing app experiences using on-device capabilities only, the real leverage I think only comes once you add dynamic content that is created by you or other users of the app. It’s when you change from product to platform, from utility to interaction.

To cut a long story short: For most of your app ideas, you need a backend.

CloudKit, Firebase or other services may suffice for the moment, but I have had the experience that your own hand-crafted backend really adds a new dimension to the experience you can create. Besides, it keeps your clients very lean.

How Swift helps you achieve that

I think when you can use Swift (a language that you probably have come to love on iOS or macOS) in your backend, too, it adds so many options to the ideas you can realize on your own. It changes how fast you can create something of value. You can share code, reuse architectural patterns, add features side-by-side and simplify your client-side app by moving code to the server.

You can just create the whole experience by yourself in one amazing language and integrate client side with server side seamlessly.

By sharing a little story about how we added a new feature to our app Courtastic, I hope I can inspire you to think what new experiences you could create very fast with your own Swift backend.

Example: Courtastic Booking Suggestions

Courtastic is a tennis club platform that organizes court bookings in real time but also attempts to create more activity in a club. We believe that modern technology allows so many great features of enriching the sports club life that were never possible before.

One of these features that we built to increase activity in clubs is suggestions: based on a player’s previous matches from the database, our backend computes suggestions for new bookings they might consider. It’s currently only a simple statistical analysis, but now that Perfect has introduced adapters for machine learning frameworks we think about making suggestions more sound using artificial intelligence.

When a player opens our app and doesn’t have a booking coming up, these suggestions show up and can be booked with one click.

How Swift made this feature possible, very fast

I think if you build something for other people (not just a tool for yourself), you should begin with the user experience in mind. Hence, I started by sketching some ideas of how the suggestions would feel and look like in the final app. Soon I built the UI and logic in the iOS app — including the data model (a Suggestion struct).

Because I didn’t have to worry about how the suggestions are computed or created or persisted — this is done by our backend — I could focus almost exclusively on the UX part.

Then, I just copied the UI-independent code like this model entity, added some database-relevant functions for the backend and that was it. The only thing left was the actual computation of the suggestions, but because I now didn’t have to worry about how to present them or react to user interactions— this of course is done by the client apps — I could focus exclusively on the statistical analysis of previous bookings and how to do it with maximum efficiency.

To conclude, by starting with the UX and in the process defining the interface between client and server just how I needed it in the app, I was able to integrate these two platforms seamlessly and very fast. When building each one, I didn’t have to worry about the other one because I knew that the interface I defined (the data model) was exactly the same on the respective other end.


I believe that with server-side Swift frameworks like Perfect (which we use) or others you as someone who has experience with building client apps with Swift can build a much broader range of different products very efficiently.

The suggestion feature described above would have definitely not been possible as efficiently as it has if our backend wasn’t basically a seamless extension to the client side which encapsulates all the logic to keep the clients lean.

So, what will you create?

Thanks for reading! If you have any suggestion on how to improve this article, please tell me.

Disclaimer: I’m not (yet?) affiliated in any way with PerfectlySoft Inc.