Small presentation given at http://theswiftalps.com on November 10th, 2016, about the current options for server side apps written in Swift: Perfect, Vapor, Kitura and Zewo.
Server SideSwiftSwift ! " @akosma in Twitter, Github, Medium & LinkedIn.© akosma 2016 1
View Slide
Kitura11 http://www.kitura.io© akosma 2016 2
Kiturawwdcwwdc https://developer.apple.com/videos/play/wwdc2016/415/© akosma 2016 3
Kituraibmibm https://developer.ibm.com/swift/© akosma 2016 4
import Kituralet router = Router()router.get("/") {request, response, next inresponse.send("Hello, World!")next()}Kitura.addHTTPServer(onPort: 8090, with: router)Kitura.run()https://github.com/IBM-Swift/Kitura© akosma 2016 5
Perfect22 http://perfect.org© akosma 2016 6
import PerfectLibimport PerfectHTTPimport PerfectHTTPServerlet server = HTTPServer()var routes = Routes()routes.add(method: .get, uri: "/", handler: { request, response inresponse.setHeader(.contentType, value: "text/html")response.appendBody(string: "Hello, world!")response.completed()})server.addRoutes(routes)server.serverPort = 8181do {try server.start()} catch PerfectError.networkError(let err, let msg) {print("Network error thrown: \(err) \(msg)")}https://github.com/PerfectlySoft/Perfect© akosma 2016 7
Vapor33 http://vapor.codes© akosma 2016 8
import Vaporlet drop = Droplet()drop.get("hello") { req inreturn "Hello, world."}drop.run()https://github.com/vapor/vapor© akosma 2016 9
Zewo55 http://www.zewo.io© akosma 2016 10
import HTTPServerlet router = BasicRouter { route inroute.get("/hello") { request inreturn Response(body: "Hello, world!")}}let server = try Server(configuration: ["port": 8080],responder: router)try server.start()https://github.com/Zewo/Zewo© akosma 2016 11
Server APIs Workgroupgroup https://swift.org/blog/server-api-workgroup/© akosma 2016 12
Server Side Standards forSwift – S44 https://github.com/open-swift/S4© akosma 2016 13
import PackageDescriptionlet package = Package(dependencies: [.Package(url: "https://github.com/open-swift/S4.git",majorVersion: 0,minor: 11)])https://github.com/open-swift/S4© akosma 2016 14
swift package generate-xcodeproj© akosma 2016 15
Perfect Vapor Kitura Zewo S4Inspiration Ruby on Rails Laravel Express.js Go (libmill) Open InitiativeDesign Monolithic Modular IBM Modular In progressDeployment nginx, Docker,HerokuBluemix, AWS,Heroku…Apache, nginx,BluemixDatabases Mongo, MySQL,FileMaker…Mongo,MySQL…Templating Mustache Leaf MustacheLicense Apache MIT Apache MIT MITStars0 9200 7200 4800 1400 100More StORM,Websockets,FastCGIWebsockets WWDC16 4150 as of November 2016© akosma 2016 16
Swift Protobufbuf https://github.com/apple/swift-protobuf© akosma 2016 17
SwiftCGICGI https://github.com/allevato/SwiftCGI andhttps://github.com/ianthetechie/SwiftCGI© akosma 2016 18
Newsletterletter https://www.serverswift.tech© akosma 2016 19
Workshop—3 sessions of 2h each: 11:30, 14:30 & 16:30—Build a web API & iOS client 100% Swift—Specifications—Free choice of tools & frameworks—Team effort—Guidance and support—Fun!© akosma 2016 20
Competition!—Number of implemented use cases—Code coverage—Weighted by number of team members—Imagination! with a trophy! " chocolate!© akosma 2016 21
ScheduleTime Thursday 10th Friday 11th09:00 - 09:30 Registrations Welcome back09:30 - 11:30 Presentations Work Session 411:30 - 13:30 Work Session 1 Work Session 513:30 - 14:30 Lunch Lunch14:30 - 16:30 Work Session 2 Work Session 616:30 - 18:30 Work Session 3 Presentations & End© akosma 2016 22
Thanks!!Questions?! https://speakerdeck.com/akosma© akosma 2016 23