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
Introduction of Swift HTTP APIs
Search
Shun Takebayashi
June 27, 2017
Programming
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Introduction of Swift HTTP APIs
Shun Takebayashi
June 27, 2017
More Decks by Shun Takebayashi
See All by Shun Takebayashi
はじめてのSwift Server API / Beginning Swift Server API
takebayashi
1
740
The Ecosystem of Web Development with Swift
takebayashi
4
1.3k
Other Decks in Programming
See All in Programming
Distance field of Julia set
kinakomoti321
0
310
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
150
まずはコードより業務と向き合う:テーブル解体のためにPdMを呼んだ話
sakawe_ee
0
180
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
220
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
420
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
310
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.4k
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
160
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
graphql-ruby を Spinel で速くしようとした話
mtsmfm
0
140
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
160
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
360
Featured
See All Featured
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
330
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
390
The browser strikes back
jonoalderson
0
1.9k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
390
GraphQLとの向き合い方2022年版
quramy
50
15k
Test your architecture with Archunit
thirion
2
2.5k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
470
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Code Reviewing Like a Champion
maltzj
529
40k
Visualization
eitanlees
153
17k
Transcript
Introduction of Swift HTTP APIs Shun Takebayashi
History of Server-Side Swift
History of Server-Side Swift (Dec 2015) • Apple open-sourced Swift
History of Server-Side Swift ( - Mid 2016) • App
frameworks • Perfect • Kitura • No standard APIs • Third-party API specifications • Nest • OpenSwift / S4
The Ecosystem of Web Development with Swift Shun Takebayashi takebayashi
https://speakerdeck.com/takebayashi/the-ecosystem-of-web-development-with-swift
History of Server-Side Swift (Oct 2016) • Apple announces Server
APIs Work Group • Working on 3 layers: • Base networking • Security / Encryption • HTTP / WebSocket
͜Ε͔Β͡ΊΔ αʔόʔαΠυ Swift Tokyo Server Side Swift Meetup #7 @
Speee Lounge - 2017.5.26 https://speakerdeck.com/jp_pancake/korekarahazimerusabasaido-swift
What are HTTP APIs?
HTTP APIs are NOT… • Web application frameworks • Stable
specification
HTTP APIs are… • Low-level types and interfaces • Still
under discussion
Exploring HTTP APIs
https://github.com/swift-server/http/blob/develop/API.md
Types in HTTP APIs • HTTPRequest • HTTPResponse • HTTPResponseWriter
• HTTPBodyHandler • HTTPBodyProcessing • HTTPBodyChunk • etc…
Interfaces in HTTP APIs typealias WebApp = (HTTPRequest, HTTPResponseWriter) ->
HTTPBodyProcessing
Interfaces in HTTP APIs enum HTTPBodyProcessing { case discardBody case
processBody(handler: HTTPBodyHandler) } typealias HTTPBodyHandler = (HTTPBodyChunk, inout Bool) -> Void
Sample App let myApp = { (req: HTTPRequest, res: HTTPResponseWriter
) -> HTTPBodyProcessing in res.writeResponse(HTTPResponse( httpVersion: req.httpVersion, status: .ok, transferEncoding: .chunked, headers: HTTPHeaders([("Content-Type", "text/plain")]) )) return .processBody { (chunk, stop) in switch chunk { case .chunk(let data, let finishedProcessing): res.writeBody(data: data) { _ in finishedProcessing() } case .end: res.done() default: stop = true res.abort() } } }
Implementations
BlueSocketHTTP • Prototype implementation of HTTP APIs • Based on
IBM BlueSocket https://github.com/swift-server/http/tree/develop/Sources/BlueSocketHTTP
Deploying with BlueSocketHTTP import HTTP import BlueSocketHTTP let server =
BlueSocketSimpleServer() do { try server.start(port: 8080, webapp: myApp) }
Summary
Swift HTTP APIs are… • Low-level types and functions •
for handling/responding to requests • Unstable, but prototype implementations are available • You can try with BlueSocketHTTP
Happy Server-Side Swift