Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Server Side Swift

DZone's Guide to

Server Side Swift

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.

· Mobile Zone
Free Resource

Get gorgeous, multi-touch charts for your iOS application with just a few lines of code.

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 article was first published on my personal blog.

.Net developers: use Highcharts, the industry's leading interactive charting library, without writing a single line of JavaScript.

Topics:
server ,functional programming ,server-side ,web service ,apple ,service ,swift

Published at DZone with permission of Ana Nogal, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}