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
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
130
JavaScriptのデバッグ/2023-09-04-llt30
ottijp
0
200
CDK for TerraformでAzureリソースをデプロイする/2023-05-15-llt29
ottijp
1
350
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
A2UI for Android: Safely Rendering AI-Generated UI with Jetpack Compose - DroidKaigi 2026
itsmedreamwalker
0
140
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
1
1k
FreeBSDでZabbixを動かす
kenkino
0
290
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
150
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
290
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
120
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1k
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
340
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
1.9k
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
330
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.6k
Featured
See All Featured
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
700
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
580
How GitHub (no longer) Works
holman
316
150k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
540
The Mindset for Success: Future Career Progression
greggifford
PRO
0
490
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Done Done
chrislema
186
16k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
36k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
500
The Cult of Friendly URLs
andyhume
79
7k
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