Server-side developers take a shine to Swift

Proponents including IBM see great potential in Apple's up-and-coming language for building web apps and services

Server-side developers take a shine to Swift
anthony kelly (CC BY 2.0)

Apple's Swift language -- the company's heir to Objective-C for iOS and MacOS development -- is beginning to present opportunities on the server side of the IT equation. Companies ranging from startup PerfectlySoft to stalwart IBM are seizing on Swift's potential to bring speed, safety, and ease to web application developers.

Introduced in June 2014 and open sourced in December of last year, Swift is a modern language that combines the depth and power of C with the ease-of-use of interpreted languages like Python. As a result, Swift has been quick to draw interest from non-Apple and cross-platform developers.

"I've been writing software for a long time, and it sometimes feels like a new hit language is being hyped every week," said developer Sven Schmidt, who has participated in the Vapor project, a web framework for Swift that runs on Ubuntu, OS X, and iOS. "But Swift is different in that it's backed by a big, big player and ticks a lot of boxes for what people expect from a modern language these days."

Vapor, a modular, server-side framework for developing of cloud-based apps, leverages the type safety in Swift and offers pattern matching to simplify routing. A co-developer of the framework, Logan Wright, sees Swift's potential on the server because it already accommodates iOS developers and can enable code-sharing among different platforms.

"We've already seen an explosion of projects pushing out to the cloud and I think we're just beginning to tap Swift's potential," Wright said. "A few weeks back we saw some indicators of potential Windows support in the code base. As much as there is to do in the cloud, we're seeing potential for an extremely versatile cross-platform community."

PerfectlySoft is tapping Swift for its open source Perfect application server and framework for building Web applications and REST services. Perfect runs on Linux or OS X and is geared to mobile apps requiring back-end server connections. The goal, according to PerfectlySoft CEO Sean Stephens, was to "make an easy on-ramp," to allow developers to leverage Swift on the server without having to be a "genius programmer."

With Swift, development teams could build entire applications for both the client and server. "If you really want to build a team that's able to communicate effectively, you want everybody to be able to use the same language," Stephens said.

Schmidt concurs. "There is a big benefit to being able to write software with the same language on client and server. Components can be shared, obviously, but especially for smaller companies or teams, it means there's less need for specialization." But Swift's move to servers will not happen overnight, Schmidt noted, because it currently lacks the ecosystem of libraries and extensions available to other languages.

PerfectlySoft's business plan involves offering tools to enable developers to get onto cloud platforms like Microsoft Azure, Amazon Web Services, and Heroku, with the company getting a cut of revenues from the cloud providers. "Swift on the server is going to happen," said Stephens.

Perfect is intended to fill certain gaps in Swift. While Swift now can compile to Linux, Stephens noted that it still lacks capabilities to send out data and does not have core functions for such web services as managing cookies, files, and URLs. "The language is the language. It doesn't have any of those constructs. So we've created those constructs," he said. Stephens also sees Swift's eventual placement on Windows platforms as well.

IBM has taken a shine to Swift for its code safety, clarity, and brevity. "We found that we dramatically cut the lines of code in our typical applications when we did a comparison with Objective-C, and even when looking at some of the Java-based code that we have in Android," said John Ponzo, CTO for IBM's Mobile First initiative. The company has been working on enabling Swift on servers since the language made its way to Linux in December.

Big Blue's Kitura web framework, written in Swift, presents a modular platform for deploying applications on IBM's Bluemix cloud on either OS X or Linux. Developers can build web services with "complex" routes, according to IBM, and server-side web interfaces. Concurrency is offered through Apple's Grand Central Dispatch software, which IBM is porting to Linux. IBM Cloud Tools for Swift, meanwhile, works with Apple's Xcode development environment to link client-side code and applications to Swift-based back-end server code.

Zewo, which provides open source libraries for "modern server software," also is attempting to link Swift to servers. It features ZeroMQ, which provides a distributed messaging binding for Swift 3, while Zewo OpenSSL provides Swift OpenSSL for OS X and Linux. Zewo offers extensible modules to simplify developing end-to-end web applications in Swift.

"We are building a large developer community around server-side Swift, much like the Node.js community built around server-side JavaScript," Zewo community member Dan Appel said. "We want to make it easy for developers to create back-end applications with a portable, modular architecture. We already have over 50 modules to date and over 400 members in our Slack group."

Zewo proponents see Swift becoming a main server-side language for years to come, Appel said. "The advantages of using Swift on the server go beyond just having the ability to share code with iOS. Swift is an incredibly safe, expressive, fast, and powerful language."

Copyright © 2016 IDG Communications, Inc.