Getting Started with Swift Web Frameworks
-
Upload
all-things-open -
Category
Technology
-
view
111 -
download
1
Transcript of Getting Started with Swift Web Frameworks
Getting Started with Swift Web Frameworks
Presented by Edward Jiang 10/26/16 at All Things Open
Hi, I’m Edward!@EdwardStarcraft:
Developer Evangelist @Stormpath.
Formerly iOS @PadMapper, Founder @StudentRND.
Announced June 2014
Swift
Developers Love Swift
“For the second year in a row Rust, Swift and Go make the top 5 most loved programming languages.”
Apple Open Sourced Swift in December 2015
Swift Package Manager
Swift on Linux
Why not Swift for the Web?
Over 22,000 stars on GitHub
Zewo
Perfect
Perfect
Vapor
Kitura
Zewo
Let’s build our first Vapor app!
Step 1: Install Swift Version
Manager
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
Install Swift 3.0
$ swiftenv install 3.0
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/
Add Vapor to your Package.swift
import PackageDescription
let package = Package( name: "HelloWorld", dependencies: [ .Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1) ] )
Open in Xcode
$ swift package generate-xcodeproj $ open HelloWorld.xcodeproj
Code!
Let’s Run This!
Now…to deploy to the web!
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
And we’re running!
Contributing to Swift
Submit a Pull Request!
apple/swift apple/swift-corelibs-foundation
apple/swift-evolution swift-server/work-group
Contributing to Web Frameworks
Thanks Everyone!
@EdwardStarcraft: Developer Evangelist
@Stormpath.
Check out Turnstile: Auth for Server Side Swift