Server side Swift

In December 2015 Apple open-sourced Swift, which has been a real success. Many developers are contributing, not only via pull requests directly into the source code, but also by helping to define the shape of the language in the swift-evolution repository. One of the things that came with Swift was server-side development. There's a new version of Swift developed for Linux with a toolset that includes a package manager, the LLDB debugger, and the REPL. This opens a whole set of new possibilities for a lot of companies, such as IBM who are currently making a huge investment in its framework Kitura.

So why?

  • Compared to Python or Ruby - it is super fast and a type-safe language.
  • It is a language which allows developers to write expressive code.
  • As an iOS developer, you can stay in the same technology stack. If you need to develop a Web service for your iOS app to retrieve data, you can write that in the same language, using the same tooling...
  • Devs love Swift :)

So, what's on the market?

There's a lot of small frameworks that take advantage of these new possibilities, so have a look here where Edward Jiang does a great job of introducing four of the more promising frameworks already in the market. I'm divided between Vapor and Kitura:

  • The first one is growing in popularity and is starting to be the one to used in all tutorials that I've picked up:
    • It's inspired by Laravel
    • Aims to be expressive and simple to use
    • Has great documentation
  • The second, Kitura, is from IBM, which reveals the extent of their belief in the advantages of this approach to application development. Alongside the core framework, IBM has also invested in:
    • A package manager, which allows developers to add their own packages
    • A sandbox environment, to allow developers to test Swift on the server-side
    • A Cloud server that is specialised for deploying Swift

Kitura is based on Express.js, so if you are already using it you will find almost no differences at project level structure and so on.

If you want to have a look of all the stack that IBM has, you can go here.

Can you convince me?

You are a backend developer and you thinking: "Nah... I'm not going to learn a new whole language..." Well, don't forget that Swift, first of all, is a type-safe language. And it's a hybrid in that it supports Object-Oriented and Functional programming. A huge advantage of this is the ability to introduce yourself into functional programming, but still be "safe" in your object-oriented skills. Yes, you would have to learn a new language... But it's Swift! Not convinced yet? Take a look at these 2 articles that compare server side Swift (in this case Vapor) with a lot of other well-known languages:

Please note that these tests were made before Swift 3.0 came out.

Conclusion

If you are a iOS developer, and you need to have a Web service for your app, you should definitely consider one of these options, since you won't need to learn another language to deploy your Web service. If you are a backend developer, you can always learn a new, type-safe, language and then who knows? Maybe start creating your own iOS apps?


This post was cross-posted to my personal blog.

Get content like this straight to your inbox!

Software es nuestra pasión.

Somos Software Craftspeople. Construimos software bien elaborado para nuestros clientes, ayudamos a los/as desarrolladores/as a mejorar en su oficio a través de la formación, la orientación y la tutoría. Ayudamos a las empresas a mejorar en la distribución de software.

Contacto

3 Sutton Lane, planta 3
Londres, EC1M 5PU

Teléfono: +44 207 4902967

2 Mount Street
Manchester, M2 5WQ

Teléfono: +44 161 302 6795

Carrer de Pallars 99, planta 4, sala 41
Barcelona, 08018

Teléfono: +34 937 82 28 82

Correo electrónico: hello@codurance.es