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

Super Spectacular Server-Side Swift!

Super Spectacular Server-Side Swift!

Now that Swift is open-source and cross-platform, several teams are racing to make Swift a viable language for web development. The major frameworks: Perfect, Vapor, IBM Kitura, and Zewo have over 15,000 stars on GitHub, and are growing quickly! Join us as we talk about the different frameworks, their pros and cons, and an introduction for how to get started with developing in server side Swift. Join Edward for a live coding demo and even deploy a Swift application to the cloud!

Presented at the Swift Lang Meetup
http://www.meetup.com/swift-language/events/230862555/

Video here:
https://realm.io/news/slug-edward-jiang-server-side-swift/

Writeup:
https://stormpath.com/blog/swift-on-the-server-today

Copy and Paste the Coding Demo:
https://stormpath.com/blog/tutorial-build-first-swift-web-app-vapor

Follow me on Twitter: https://twitter.com/edwardstarcraft

A4793bb12794f8576b67bb7cf4cb9773?s=128

Edward Jiang

June 09, 2016
Tweet

Transcript

  1. Super Spectacular Server-Side Swift Presented by Edward Jiang 6/9/16 at

    Swift Lang Meetup
  2. Hi, I’m Edward! @EdwardStarcraft: Developer Evangelist @Stormpath. Formerly iOS @PadMapper,

    Founder @StudentRND.
  3. Why Swift for Web? • Fast • Safe • Expressive

    • Developers love Swift!
  4. Over 15,000 stars on GitHub Zewo

  5. Perfect • Most stars (7,200+) • Aims to be like

    “Rails” for Swift • Boasts an impressive set of features
  6. Perfect

  7. Vapor • 4,000+ stars • Laravel-inspired • Aims to be

    expressive, yet simple • Excellent documentation
  8. Vapor

  9. IBM Kitura • 3,000+ stars • Express.js inspired

  10. Kitura

  11. Zewo • Super modular (50+ packages) • Base components interchangeable

    with Vapor
  12. Open Swift

  13. Zewo

  14. Swift Web Frameworks Perfect Vapor Kitura Zewo Swift Version 2.2

    2016-05-31 2016-05-09 2016-04-12 Template Engine ✓ ✓ ✓ ✓ ORM ✓ ✓ ✓
  15. Why So Many Swift Versions?

  16. Swift Package Manager

  17. Let’s build our first Vapor app!

  18. Step 1: Install Swift Version Manager

  19. Install Swift Version Manager $ git clone https://github.com/kylef/swiftenv.git ~/.swiftenv $

    echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bash_profile $ echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(swiftenv init -)"' >> ~/.bash_profile
  20. Install Swift 5-31 $ swiftenv install DEVELOPMENT-SNAPSHOT-2016-05-31-a

  21. Initialize Your Project $ mkdir HelloWorld $ cd HelloWorld $

    swiftenv local DEVELOPMENT- SNAPSHOT-2016-05-31-a $ swift package init --type executable Creating executable package: HelloWorld Creating Package.swift Creating Sources/ Creating Sources/main.swift Creating Tests/
  22. Add Vapor to your Package.swift import PackageDescription let package =

    Package( name: "HelloWorld", dependencies: [ .Package(url: "https://github.com/ qutheory/vapor.git", majorVersion: 0, minor: 10) ] )
  23. Open in Xcode $ swift package generate-xcodeproj $ open HelloWorld.xcodeproj

  24. Code!

  25. Let’s Run This!

  26. Now…to deploy to the web!

  27. Now…to deploy to the web! $ git init $ heroku

    create $ heroku buildpacks:set https:// github.com/kylef/heroku-buildpack-swift $ echo 'web: HelloWorld --port=$PORT' >> Procfile $ git add . $ git commit -m "created project" $ git push heroku master
  28. And we’re running!

  29. Is Server-Side Swift Ready for Production?

  30. No. • Foundation still incomplete on Linux • Managing Swift

    Versions & Dependencies can be hell • Should be a lot better after the Swift 3 Preview or Release
  31. But will it be awesome?

  32. None
  33. Contributing • Vapor, Zewo, Open Swift easiest to contribute •

    Join their Slack channels!