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
Swift Everywhere/2019-01-23-llt6
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Satoshi SAKAO
January 23, 2019
Programming
88
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift Everywhere/2019-01-23-llt6
社内のLTイベント「えるLT Vol.6」で発表した資料です
Satoshi SAKAO
January 23, 2019
More Decks by Satoshi SAKAO
See All by Satoshi SAKAO
Testcontainers/2024-11-20-llt32
ottijp
0
120
Pkl/2024-04-17-llt31
ottijp
0
140
JavaScriptのデバッグ/2023-09-04-llt30
ottijp
0
200
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-llt29
ottijp
1
360
TWELITEへの誘い/2022-12-27-llt28
ottijp
0
190
ビルドツールBazelを触ってみた/2022-09-28-llt27
ottijp
0
230
HashiCorp Vaultを使ったシークレットのセキュアな一元管理 〜Ansibleを添えて〜/2022-07-12-llt26
ottijp
0
190
AWSインフラのデプロイをCDKでカイゼンする/2022-03-23-llt25
ottijp
0
130
Amazon Timestreamでデータ補間/2021-12-27-llt24
ottijp
0
130
Other Decks in Programming
See All in Programming
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
Event is what happens
moro
2
780
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
370
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
Jetpack Compose Mechanisms
skydoves
3
820
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
410
外から家のPCの電源入れたい!をPHPで解決する
kawashimo0
1
130
Domain-Driven Transformation
hschwentner
2
2.3k
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
150
Featured
See All Featured
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
Embracing the Ebb and Flow
colly
88
5.2k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
YesSQL, Process and Tooling at Scale
rocio
174
15k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
67k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Design in an AI World
tapps
1
350
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
460
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Transcript
Swift Everywhere Satoshi SAKAO えるLT Vol.6 2019/01/23 (Wed) E1
話すひと E2 インフォコム株式会社 オープンイノベーションセンター " アプリケーションエンジニア JS (ES6) / Node.js
/ GCP / IoT / iOS (Swift) エースコンバット7 Satoshi SAKAO @ottijp
E3 I ❤ Swift.
E4 Swiftは何を作るための言語?
Not only E5 macOSアプリ iOSアプリ
But also E6 サーバサイド 組み込み
E7 簡単なIoTシステムを全部Swiftで作った
構成 E8
できあがったもの E9
E10 サーバサイド
Vapor • Webフレームワーク • 他の一般的なWebフレームワークと同じような感じ • ORM・認証・暗号化・WebSocket・テンプレートエンジンなどの パッケージが一通り揃っている • Herokuへのデプロイを標準でサポート(buildpackの提供)
• Xcodeでの開発をサポート(Xcodeプロジェクトの作成) • モダンで型安全で速い!! E11
Vapor E12 https://medium.com/@codevapor/vapor-3-0-0-released-8356fa619a5d
E13 組み込み
ラズパイでSwift • ずいぶん前に買って放置していたラズパイを使った • uraimo/buildSwiftOnARM のビルド済みSwiftを利用 • ライブラリ • HTTPクライアントは
shiroyagicorp/swift-seeurl を利用 • uramio/SwiftyGPIO でGPIOピンを制御 E14
SPM: Swift Package Manager E15 1 // swift-tools-version:4.0 2 //
The swift-tools-version declares the minimum version of Swift required to build this package. 3 4 import PackageDescription 5 6 let package = Package( 7 name: "SwiftyPi", 8 dependencies: [ 9 .package(url: "https://github.com/uraimo/SwiftyGPIO.git", from: "1.0.0"), 10 .package(url: "https://github.com/shiroyagicorp/swift-seeurl.git", from: "1.9.0") 11 ], 12 targets: [ 13 .target( 14 name: "SwiftyPi", 15 dependencies: ["SwiftyGPIO", "SeeURL"]), 16 ] 17 )
E16 iOSアプリ(省略)
構成 E17
まとめ • SwiftはmacOS/iOSアプリを作るためだけのものじゃない • サーバサイドも組み込みもOK! • AWS Lambdaのファンクションも作れるし, 公式Dockerイメージもある •
macOS/iOSアプリ開発のスキルセットを他に応用できるかも • 型安全でパフォーマンスの良いSwiftが多分野で広まってほしい E18
E19 You also will ❤ Swift.
$ exit E20
E21 Appendix
環境 • WebAPIサーバ • Swift 4.2 / Vapor 3.0 /
Heroku (Heroku-16 stack) • iOSアプリ • Swift 4.2 / iOS 12.1 • エンドデバイス • Swift 4.1.3 / Raspbery Pi 3 Model B / Rasbian 2018-11-13 (Debian 9.6) • 開発環境 • macOS 10.14.2 (Mojave) / Xcode 10.1 E22
コードとブログ • 作ったコード • https://github.com/ottijp/all-swift-iot-server • https://github.com/ottijp/all-swift-iot-enddevice • https://github.com/ottijp/all-swift-iot-client •
書いたブログ • https://qiita.com/ottijp/items/51a2666279f767aaa7a2 E23
詰まったところ(サーバサイド) • Futureの概念の理解 • SwiftNIOの機能 • 非同期のためのもので,JSのPromiseみたいなもの • テンプレートコードを読むだけでは理解しづらかった •
ちゃんとドキュメントを読んだほうが良い • https://docs.vapor.codes/3.0/async/overview/ • PostgreSQLへの変更 • apiテンプレートのデフォルトはSQLiteのメモリ保存 • Heroku Postgresへの接続はSSL設定をDB設定に入れる必要がある E24
詰まったところ(ラズパイ) • buildSwiftOnARMのREADMEの通りにやってもビルドできない • /usr/bin/clang がない • apt-get install で作られない
• 手動でシンボリックリンクを作った • 実行可能ファイルが生成されたように見えてされてない • swiftのソースビルドに必要なパッケージを全部入れてみた • 一応動作するようになった • たまにエラーが出る • error: unable to attach DB: error: accessing build database • 原因不明 E25