Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Adrian Kosmaczewski

November 10, 2016
Tweet

More Decks by Adrian Kosmaczewski

Other Decks in Technology

Transcript

  1. Server SideSwift
    Swift ! " @akosma in Twitter, Github, Medium & LinkedIn.
    © akosma 2016 1

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  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

    View Slide

  6. Perfect2
    2 http://perfect.org
    © akosma 2016 6

    View Slide

  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: "Hello, world!")
    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

    View Slide

  8. Vapor3
    3 http://vapor.codes
    © akosma 2016 8

    View Slide

  9. import Vapor
    let drop = Droplet()
    drop.get("hello") { req in
    return "Hello, world."
    }
    drop.run()
    https://github.com/vapor/vapor
    © akosma 2016 9

    View Slide

  10. Zewo5
    5 http://www.zewo.io
    © akosma 2016 10

    View Slide

  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

    View Slide

  12. Server APIs Workgroup
    group https://swift.org/blog/server-api-workgroup/
    © akosma 2016 12

    View Slide

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

    View Slide

  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

    View Slide

  15. swift package generate-xcodeproj
    © akosma 2016 15

    View Slide

  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

    View Slide

  17. Swift Protobuf
    buf https://github.com/apple/swift-protobuf
    © akosma 2016 17

    View Slide

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

    View Slide

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

    View Slide

  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

    View Slide

  21. Competition!
    —Number of implemented use cases
    —Code coverage
    —Weighted by number of team members
    —Imagination
    ! with a trophy! " chocolate!
    © akosma 2016 21

    View Slide

  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

    View Slide

  23. Thanks!!
    Questions?
    ! https://speakerdeck.com/akosma
    © akosma 2016 23

    View Slide