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

Edward Jiang

June 09, 2016
Tweet

More Decks by Edward Jiang

Other Decks in Programming

Transcript

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

    “Rails” for Swift • Boasts an impressive set of features
  2. Vapor • 4,000+ stars • Laravel-inspired • Aims to be

    expressive, yet simple • Excellent documentation
  3. Swift Web Frameworks Perfect Vapor Kitura Zewo Swift Version 2.2

    2016-05-31 2016-05-09 2016-04-12 Template Engine ✓ ✓ ✓ ✓ ORM ✓ ✓ ✓
  4. 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
  5. 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/
  6. 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) ] )
  7. 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
  8. 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