Page 1
By@Cegonya@Coderpug
SERVER SIDE DEVELOPMENTSWIFT + VAPOR
Page 2
@cegonya @coderpug
Page 4
“The powerful programming language
that is also easy to learn”Apple
Page 5
HISTORYIntroduced at
Page 6
HISTORYSwift 2.0 released at
Page 7
HISTORY
Swift 2.2 was made Open Source Software on Dec 3 2015
“One of the most exciting aspects of developing Swift in the open is knowing that it is now free to be ported across a wide range of platforms, devices, and use cases”
https://swift.org
Page 8
HISTORY
Open Source Software (OSS) ???
iOS macOS watchOS tvOS
SERVER
Page 9
HISTORYSwift 3.0 released at
Page 10
PERFORMANCE
(2014) http://www.primatelabs.com/blog/2014/12/swift-performance/
Page 11
PERFORMANCE
(2016) http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=spectralnorm
Page 12
SERVER-SIDE EFFORTS
Page 13
Web Frameworks and HTTP Server
PERFECT VAPOR KITURA
ZEWO
Page 14
MOST USED
https://github.com/paulofaria/swiftpm-packages-statistics
Page 15
BENCHMARK
https://medium.com/@qutheory/server-side-swift-vs-the-other-guys-2-speed-ca65b2f79505#.vh4uy8mqh
Page 16
BENCHMARK
https://medium.com/@qutheory/server-side-swift-vs-the-other-guys-2-speed-ca65b2f79505#.vh4uy8mqh
Page 17
BENCHMARK
https://medium.com/@qutheory/server-side-swift-vs-the-other-guys-2-speed-ca65b2f79505#.vh4uy8mqh
Page 18
SWIFT SERVER APIs WORK GROUP
https://swift.org/server-apis/
Page 21
ENGINE
MODULES
https://github.com/vapor/engine
Page 22
STRUCTURE
PROJECT
. ├── Sources │ └── App │ └── Controllers │ └── Middleware │ └── Models │ └── main.swift ├── Public ├── Resources │ └── Views └── Package.swift
Page 23
ROUTING
PROJECT
Standard HTTP methods GET/POST/PUT/DELETE and more.
Basic : Method + Path + Closure
Page 24
VIEWS/Leaf
PROJECT
Template framework
Token-based #
Page 28
Requirements : Xcode 8+ with Swift 3+
Vapor toolbox :Install
curl -sL toolbox.vapor.sh | bash
ENVIRONMENT SETUP
Page 29
ENVIRONMENT SETUP
Page 30
vapor xcode
ENVIRONMENT SETUP
Create a base template project
From the project folder
vapor new Hello
Page 31
ENVIRONMENT SETUP
Page 32
DEMO
Pugmanityhttp://shrouded-forest-39648.herokuapp.com/
https://github.com/CoderPug/pugmanity
Page 33
READY 4 PRODUCTION?
Page 35
SWIFT 3 does NOT have ABI Compatibility
Page 36
Web Frameworks < 1 yo
Server = Maturity
Page 41
http://nsconfarg.com/
Page 42
www.twitter.com/cocoalima
Page 45
main.swiftFMhttp://www.cocoalima.com/mainswift
https://github.com/CoderPug/main.swiftFM
Page 46
www.santexgroup.com