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

Getting Started with Swift Web Frameworks

Getting Started with Swift Web Frameworks

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 22,000 stars on GitHub, and are growing quickly!

Learn about the evolution of Swift, the different web frameworks, 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 All Things Open 2016
https://allthingsopen.org

Perfect: https://perfect.org
Vapor: https://vapor.codes
Kitura: http://kitura.io
Zewo: http://zewo.io

Turnstile Auth for server-side Swift: https://github.com/stormpath/Turnstile

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

A4793bb12794f8576b67bb7cf4cb9773?s=128

Edward Jiang

October 26, 2016
Tweet

Transcript

  1. Getting Started with Swift Web Frameworks Presented by Edward Jiang

    10/26/16 at All Things Open
  2. Hi, I’m Edward! @EdwardStarcraft: Developer Evangelist @Stormpath. Formerly iOS @PadMapper,

    Founder @StudentRND.
  3. Announced June 2014 Swift

  4. None
  5. Developers Love Swift

  6. “For the second year in a row Rust, Swift and

    Go make the top 5 most loved programming languages.”
  7. Apple Open Sourced Swift in December 2015

  8. None
  9. None
  10. Swift Package Manager

  11. Swift on Linux

  12. Why not Swift for the Web?

  13. Over 22,000 stars on GitHub Zewo

  14. Perfect

  15. None
  16. Perfect

  17. None
  18. Vapor

  19. None
  20. Kitura

  21. Zewo

  22. None
  23. Let’s build our first Vapor app!

  24. Step 1: Install Swift Version Manager

  25. 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
  26. Install Swift 3.0 $ swiftenv install 3.0

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

    swift package init --type executable Creating executable package: HelloWorld Creating Package.swift Creating Sources/ Creating Sources/main.swift Creating Tests/
  28. Add Vapor to your Package.swift import PackageDescription let package =

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

  30. Code!

  31. Let’s Run This!

  32. Now…to deploy to the web!

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

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

  35. None
  36. Contributing to Swift

  37. None
  38. None
  39. Submit a Pull Request!

  40. apple/swift apple/swift-corelibs-foundation apple/swift-evolution swift-server/work-group

  41. Contributing to Web Frameworks

  42. None
  43. Thanks Everyone! @EdwardStarcraft: Developer Evangelist @Stormpath. Check out Turnstile: Auth

    for Server Side Swift