SERVER DEVELOPMENT ➤ Worked many years as a backend developer ➤ Kept an active interest in server development afterwards ➤ Developed in / for ➤ Google App Engine ➤ Python + Django ➤ Scala + Scalatra ➤ Clojure ➤ Go + Revel ➤ Lua + Openresty ➤ PHP + Symfony
HISTORY ➤ Original Release (closed source) June 2014 ➤ Open Source (Apache 2.0) since December 2015 ➤ Current Version 3.0.1 ➤ New language for Apple’s complete ecosystem ➤ Spearheaded by Chris Lattner (LLVM, Clang)
MODERN FEATURES ➤ Automatic Retain Counting (No GC) ➤ Safety by default ➤ Algebraic Data Types (Enums with associated data) ➤ Full Unicode Support ➤ Error handling via Non-Unwinding Exceptions ➤ Functional Programming Constructs ➤ Comes with a REPL (Commandline) & Playgrounds (Xcode) ➤ Static & Dynamic Dispatch
FUTURE FEATURES (I.E. ON AGENDA FOR SWIFT 4 OR 5) ➤ Coroutines / CSP ➤ Optional Strong Memory Lifetimes like Rust ➤ Extended Generics Support (Existentials) ➤ Performance Improvements ➤ Reflection & Dynamic Features
CURRENT FULL STACK SETUP ➤ Ruby on the Server ➤ Javascript in the Frontend ➤ SQL in the Database ➤ CSS & HTML in the Frontend ➤ Java for the Android solution ➤ Swift for the iOS Solution ➤ Thats 7 Languages! ➤ New devices, new paradigms (VR), more languages ➤ Should stride for less 1.
KITURA ➤ 5000 Github Stars ➤ "Kitura is a web framework and web server that is created for web services written in Swift." ➤ Backed by IBM ➤ IBM is investing heavily into Kitura ➤ Kitura's developers also contribute to Swift in order to improve Linux support
FIRST VERDICT ➤ The major frameworks have around 20.000 GitHub Stars together ➤ Ruby on Rails has 31.000 ➤ Huge interest (already) in Swift Server development
➤ All Swift frameworks support different features ➤ Depending on your use case, this may help you decide on a framework ➤ Most frameworks are still kinda in development or 1.0 ➤ Many features are only partially implemented
USER AUTHENTICATION ➤ Log a user in, keep a user logged in, log him out, access a user ➤ Via email / password or i.e. Google / Twitter / Facebook (OAuth) ➤ Perfect, Vapor
LOGIC-LESS TEMPLATES ➤ Syntax for search & replace placeholders in HTML Files ➤ Templates without the notion of if / else conditions ➤ “Mustache” ➤ Perfect, Vapor, Kitura, Zewo {{header}} {{#empty}} The list is empty. {{/empty}}
MIDDLEWARE ➤ Custom code which can be injected to run before and after each request / response cycle ➤ Examples: ➤ Authentication ➤ Security ➤ Caching ➤ Perfect, Vapor, Kitura, Zewo
BENCHMARKS ARE DIFFICULT ➤ There’re Swift Web Framework benchmark, but they were performed on macOS. The system and performance differs from Linux. Swift is better optimised for macOS ➤ Others only compare limited frameworks or lack the knowledge to implement the benchmark test correctly in the comparison languages ➤ One side will always be unhappy about the comparison
TECH EMPOWER BENCHMARK ➤ It compares ~40 frameworks. ➤ It has very strict rules ➤ Optimized & tested heavily by lots of users ➤ www.techempower.com/ benchmarks
STATE ➤ I’ve implemented the Techempower Plaintext benchmarks for Perfect, Kitura, and Vapor ➤ I’ve then compared Swift Web Frameworks to the competition as tested by Techempower ➤ Keep in mind ➤ Swift for Linux is new. ➤ The frameworks are all in development ➤ I’ve tested this on other hardware than Techempower ($5 digital ocean droplet vs. 40 Core 32GB Ram Monster) ➤ I ran less tests (only plaintext)
SWIFT ON ANDROID ➤ 2 Facebook People and several other open source contributors ➤ Slowly evolving ➤ Uses JNI ➤ Alternative to C++ ➤ No auto-generated wrapper code yet ➤ Painful to use ➤ Give it another year
SWIFT ON THE SERVER ➤ Early, but exciting ➤ Up until Swift 3 GM, Swift changed a lot ➤ Frameworks had to adopt to these changes ➤ Frameworks are still changing. Not stable yet. ➤ Outdated examples, docs, and tutorials
SHOULD YOU CHOOSE SWIFT? ➤ It depends ➤ On how much frontend code you have ➤ On how polyglot your team is ➤ On how much shared code you expect ➤ Whether the future direction of Swift aligns with business
DOCUMENTATION ➤ Documentation is lacking for all frameworks. ➤ Possible approaches: ➤ Scout GitHub for Sample repos (though oftentimes they're outdated) ➤ Read unit tests ➤ Read Pull Requests for features. Oftentimes, they include basic usage instructions ➤ Read the source