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
Satoshi SAKAO
January 23, 2019
Programming
89
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
210
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-llt29
ottijp
1
370
TWELITEへの誘い/2022-12-27-llt28
ottijp
0
200
ビルドツールBazelを触ってみた/2022-09-28-llt27
ottijp
0
240
HashiCorp Vaultを使ったシークレットのセキュアな一元管理 〜Ansibleを添えて〜/2022-07-12-llt26
ottijp
0
200
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のためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
4
3.5k
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
160
クラウドエージェントは、 何がそんなに便利なのか / what makes cloud agents so useful
rkaga
5
800
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.4k
Seven New Principles of Software Engineering
yegor256
0
470
Spec-driven Development with AI
simas
PRO
0
2.3k
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
370
はじめてのPLATEAU
nokonoko1203
1
620
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
310
自作Discord音声botをLambda MicroVMsに移行した話 / Migrating My Discord Voice Bot to Lambda MicroVMs
akihisaikeda
1
300
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
220
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
360
Featured
See All Featured
Amusing Abliteration
ianozsvald
1
380
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
Six Lessons from altMBA
skipperchong
29
4.6k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Designing for Performance
lara
612
70k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
310
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
510
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.3k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
470
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
My Coaching Mixtape
mlcsv
0
380
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
360
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