An introduction to Server Side Swift (Tools & Framewoeks)
This post aims to provide an introduction to Server Side Swift development and covers tools and frameworks.
Tools
Swift Package Manager (SPM)
Swift Package Manager is the essential build and Dependency Management tool that runs on Mac and Linux.
Most useful SPM commands include:
swift build
to build a swift packageswift build -c release
to build a swift code for releaseswift package update
to update dependenciesswift package generate-xcodeproj
to create or update a Xcode project from Swift codeswift package resolve
to fetch all the dependencies
I will be posting a more complete guide to SPM in the future.
Xcode
IDE provided by Apple to write, compile and debug Swift code.
Although there are other options to develop Server Side Swift, Xcode is the most conventional one.
Other options include
- Text Editors such as vim, Sublime Text, Atom and VS Code + SPM
- AppCode by Jetbrains
Perfect Assistant (PA)
Developed by PerfectlySoft is the GUI to manage dependencies and build Server Side Swift for macOS and Linux.
It uses docker to build the Server Side Swift in macOS, creates docker image and spins up containers to run the server in different environments.
It also facilities deployments to cloud platforms such as Amazon Web Services (AWS) and Google Cloud Platform (GCP).
Vapor Toolbox
Vapor’s CLI provides shortcuts and assistance for common tasks
Kitura CLI
Docker
Not specific to Server Side Swift, Docker is used to containerize the code and to run it in different environments. Suppose you are developing a Server on macOS that needs to run on Linux as well, then Docker is your friend because you can use the Xcode and SPM to develop and build in macOS and ensure that your code works in Linux.
Server Side Swift Frameworks
There are many Server Side Swift Frameworks but there are 3 frameworks that are more popular against others:
Vapor
Most popular Server Side Swift framework at the moment.
Perfect
First and most stable Server Side Swift framework
Kitura
IBM’s take on Server Side Swift
Compariosn
Here is my high level comparison:
- If you are looking for a platform easier to understand and a bigger community then Vapor is your friend.
- If you are looking for an enterprise grade, and stable framework then Perfect is your friend.
- If you are invested in IBM technologies and run your environments on IBM cloud then Kitura is your best friend.
My choice would be Perfect because I aim to develop a production and enterprise level server that communicates with a Big Data Stack.
Needless to say that there will be no wrong doing on selecting any of these frameworks.
Detailed comparisons
Ryan Collins’s comprehensive post on Swift frameworks vs node.js
Vapor vs. other guys
and