Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Server-side Swift
Search
Petr Pavlik
June 20, 2016
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Server-side Swift
Petr Pavlik
June 20, 2016
Transcript
33 slides
Server-side Swift Petr Pavlik wormapp.co @ptrpavlik
Why Swift?
Why Swift? It helps you write safer code
Swift struct User { let id: String = guuid() var
name: String var aboutMe: String? } var user = User(name: "Petr", aboutMe: nil)
Swift var user = User(name: "Petr", aboutMe: nil) print("\(user)") User(id:
"34jk43k43k", name: "Petr", aboutMe: nil)
Swift var user = User(name: "Petr", aboutMe: nil) user.id =
"123" //error
Swift var user = User(name: "Petr", aboutMe: nil) user.aboutMe =
"something creative" //ok let immutableUser = user immutableUser.aboutMe = "!"#" //error
What Is Open Source
What Is Open Source • Swift Compiler
What Is Open Source • Swift Compiler • Foundation Framework
& GCD • Networking, calendar, filesystem, threading, ...
What Is Open Source • Swift Compiler • Foundation Framework
& GCD • Networking, calendar, filesystem, threading, ... • Swift Package Manager • Dependency manager
None
What Is Open Source • Swift Compiler • Foundation Framework
& GCD • Networking, calendar, filesystem, threading, ... • Swift Package Manager • Dependency manager • XCTest • Unit testing
Example App feat. Kitura
Example App $ swift build --init
Example App $ swift build --init !
Example App Example ├── Package.swift ├── Sources │ └── main.swift
└── .swiftenv
Package.swift import PackageDescription let package = Package( name: "example", dependencies:
[ .Package(url: "https://github.com/IBM-Swift/Kitura.git", majorVersion: 0, minor: 17) ])
main.swift import Kitura
main.swift import Kitura let router = Router()
main.swift import Kitura let router = Router() router.get("/") { request,
response, next in response.send("Hello, World!") next() }
main.swift import Kitura let router = Router() router.get("/") { request,
response, next in response.send("Hello, World!") next() } Kitura.addHTTPServer(onPort: 8090, with: router)
main.swift import Kitura let router = Router() router.get("/") { request,
response, next in response.send("Hello, World!") next() } Kitura.addHTTPServer(onPort: 8090, with: router) Kitura.run()
main.swift import Kitura let router = Router() router.get("/") { request,
response, next in response.send("Hello, World!") next() } Kitura.addHTTPServer(onPort: 8090, with: router) Kitura.run() //!
Example App $ swift build
Example App Example ├── Package.swift ├── Sources │ └── main.swift
├── Packages │ └── Kitura-0.16.1 │ └── Kitura-net-0.16.0 │ └── Kitura-Sys-0.16.0 │ └── LoggerAPI-0.8.0 └── .build └── debug └── example
Example App $ .build/debug/example
Example App $ .build/debug/example $ curl http://localhost:8090 Hello, World!
Example App $ swift build -X generates an Xcode project
None
Frameworks • Kitura - !/IBM-Swift/Kitura • Perfect - !/PerfectlySoft/Perfect •
Vapor - !/qutheory/vapor
Deployment • Docker • https://hub.docker.com/r/ibmcom/kitura-ubuntu/ • http://kubernetes.io • Heroku, IBM
Bluemix • Buildpack • Procfile • .swiftenv
Thank you! @ptrpavlik
More Decks by Petr Pavlik
See All by Petr Pavlik
XcodeGen
petrpavlik
0
180
Video Streaming
petrpavlik
0
28
Danger feat. SwiftLint on Linux
petrpavlik
0
570
Other Decks in Programming
See All in Programming
数行の変更でDockerビルドを最大91%高速化~GitLab CIの実行基盤を社内40リポジトリに展開するまで~
picopico
3
1.1k
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
祈るテストから、探索するテストへ 〜Lincheckではじめる並行処理テスト〜
yyh_gl
0
430
AI駆動TDD ― 2026年10月版
hrmstrsmgs
0
110
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
850
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
270
vue-tsc x TypeScript7
koukimiura
0
100
Skills Are the New npm [AAIF Bengaluru, Nov 2026]
shivamsaraswat
0
140
はじめてのPLATEAU
nokonoko1203
1
670
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
490
はじめてのKubernetesコントリビューション
nasa9084
0
330
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
340
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
700
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
450
Testing 201, or: Great Expectations
jmmastey
46
8.4k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.3k
Skip the Path - Find Your Career Trail
mkilby
1
300
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
890
The Spectacular Lies of Maps
axbom
PRO
1
1.2k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
590
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k