Slide 1

Slide 1 text

Super Spectacular Server-Side Swift Presented by Edward Jiang 6/9/16 at Swift Lang Meetup

Slide 2

Slide 2 text

Hi, I’m Edward! @EdwardStarcraft: Developer Evangelist @Stormpath. Formerly iOS @PadMapper, Founder @StudentRND.

Slide 3

Slide 3 text

Why Swift for Web? • Fast • Safe • Expressive • Developers love Swift!

Slide 4

Slide 4 text

Over 15,000 stars on GitHub Zewo

Slide 5

Slide 5 text

Perfect • Most stars (7,200+) • Aims to be like “Rails” for Swift • Boasts an impressive set of features

Slide 6

Slide 6 text

Perfect

Slide 7

Slide 7 text

Vapor • 4,000+ stars • Laravel-inspired • Aims to be expressive, yet simple • Excellent documentation

Slide 8

Slide 8 text

Vapor

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Kitura

Slide 11

Slide 11 text

Zewo • Super modular (50+ packages) • Base components interchangeable with Vapor

Slide 12

Slide 12 text

Open Swift

Slide 13

Slide 13 text

Zewo

Slide 14

Slide 14 text

Swift Web Frameworks Perfect Vapor Kitura Zewo Swift Version 2.2 2016-05-31 2016-05-09 2016-04-12 Template Engine ✓ ✓ ✓ ✓ ORM ✓ ✓ ✓

Slide 15

Slide 15 text

Why So Many Swift Versions?

Slide 16

Slide 16 text

Swift Package Manager

Slide 17

Slide 17 text

Let’s build our first Vapor app!

Slide 18

Slide 18 text

Step 1: Install Swift Version Manager

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

Install Swift 5-31 $ swiftenv install DEVELOPMENT-SNAPSHOT-2016-05-31-a

Slide 21

Slide 21 text

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/

Slide 22

Slide 22 text

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) ] )

Slide 23

Slide 23 text

Open in Xcode $ swift package generate-xcodeproj $ open HelloWorld.xcodeproj

Slide 24

Slide 24 text

Code!

Slide 25

Slide 25 text

Let’s Run This!

Slide 26

Slide 26 text

Now…to deploy to the web!

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

And we’re running!

Slide 29

Slide 29 text

Is Server-Side Swift Ready for Production?

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

But will it be awesome?

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Contributing • Vapor, Zewo, Open Swift easiest to contribute • Join their Slack channels!