Server Side Swift – State of the Union

Server Side Swift – State of the Union

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.

53619e4417778923cc65a51683e850a0?s=128

Adrian Kosmaczewski

November 10, 2016
Tweet

Transcript

  1. Server SideSwift Swift ! " @akosma in Twitter, Github, Medium

    & LinkedIn. © akosma 2016 1
  2. Kitura1 1 http://www.kitura.io © akosma 2016 2

  3. Kiturawwdc wwdc https://developer.apple.com/videos/play/wwdc2016/415/ © akosma 2016 3

  4. Kituraibm ibm https://developer.ibm.com/swift/ © akosma 2016 4

  5. import Kitura let router = Router() router.get("/") { request, response,

    next in response.send("Hello, World!") next() } Kitura.addHTTPServer(onPort: 8090, with: router) Kitura.run() https://github.com/IBM-Swift/Kitura © akosma 2016 5
  6. Perfect2 2 http://perfect.org © akosma 2016 6

  7. import PerfectLib import PerfectHTTP import PerfectHTTPServer let server = HTTPServer()

    var routes = Routes() routes.add(method: .get, uri: "/", handler: { request, response in response.setHeader(.contentType, value: "text/html") response.appendBody(string: "<p>Hello, world!</p>") response.completed() } ) server.addRoutes(routes) server.serverPort = 8181 do { try server.start() } catch PerfectError.networkError(let err, let msg) { print("Network error thrown: \(err) \(msg)") } https://github.com/PerfectlySoft/Perfect © akosma 2016 7
  8. Vapor3 3 http://vapor.codes © akosma 2016 8

  9. import Vapor let drop = Droplet() drop.get("hello") { req in

    return "Hello, world." } drop.run() https://github.com/vapor/vapor © akosma 2016 9
  10. Zewo5 5 http://www.zewo.io © akosma 2016 10

  11. import HTTPServer let router = BasicRouter { route in route.get("/hello")

    { request in return Response(body: "Hello, world!") } } let server = try Server(configuration: ["port": 8080], responder: router) try server.start() https://github.com/Zewo/Zewo © akosma 2016 11
  12. Server APIs Workgroup group https://swift.org/blog/server-api-workgroup/ © akosma 2016 12

  13. Server Side Standards for Swift – S4 4 https://github.com/open-swift/S4 ©

    akosma 2016 13
  14. import PackageDescription let 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
  15. swift package generate-xcodeproj © akosma 2016 15

  16. Perfect Vapor Kitura Zewo S4 Inspiration Ruby on Rails Laravel

    Express.js Go (libmill) Open Initiative Design Monolithic Modular IBM Modular In progress Deployment nginx, Docker, Heroku Bluemix, AWS, Heroku… Apache, nginx, Bluemix Databases Mongo, MySQL, FileMaker… Mongo, MySQL… Templating Mustache Leaf Mustache License Apache MIT Apache MIT MIT Stars0 9200 7200 4800 1400 100 More StORM, Websockets, FastCGI Websockets WWDC16 415 0 as of November 2016 © akosma 2016 16
  17. Swift Protobuf buf https://github.com/apple/swift-protobuf © akosma 2016 17

  18. SwiftCGI CGI https://github.com/allevato/SwiftCGI and https://github.com/ianthetechie/SwiftCGI © akosma 2016 18

  19. Newsletter letter https://www.serverswift.tech © akosma 2016 19

  20. 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
  21. Competition! —Number of implemented use cases —Code coverage —Weighted by

    number of team members —Imagination ! with a trophy! " chocolate! © akosma 2016 21
  22. Schedule Time Thursday 10th Friday 11th 09:00 - 09:30 Registrations

    Welcome back 09:30 - 11:30 Presentations Work Session 4 11:30 - 13:30 Work Session 1 Work Session 5 13:30 - 14:30 Lunch Lunch 14:30 - 16:30 Work Session 2 Work Session 6 16:30 - 18:30 Work Session 3 Presentations & End © akosma 2016 22
  23. Thanks!! Questions? ! https://speakerdeck.com/akosma © akosma 2016 23