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
SwiftUIの紹介/2019-11-06-llt12
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Satoshi SAKAO
November 06, 2019
Programming
95
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SwiftUIの紹介/2019-11-06-llt12
社内のLTイベント「えるLT Vol.12」で発表した資料です
Satoshi SAKAO
November 06, 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
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
The Rails Doctrine Decade
koic
2
590
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
We Are The Robots
honzajavorek
0
400
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
490
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
The SEO identity crisis: Don't let AI make you average
varn
0
590
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
How to Think Like a Performance Engineer
csswizardry
28
2.9k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
270
Building Applications with DynamoDB
mza
96
7.2k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
Transcript
SwiftUIの紹介 Satoshi SAKAO えるLT Vol.12 2019/11/06 (Wed) 1
話すひと 2 インフォコム株式会社 品質マネジメント推進室 " ソフトウェアエンジニア JS (ES6) / Node.js
/ GCP / IoT / iOS (Swift) 猫,自作キーボード,シュタゲ Satoshi SAKAO @ottijp
3 「SwiftUI」を聞いたことがある? &
SwiftUIってなんぞ • WWDC2019で発表されたAppleプラットフォーム向けの 新しいUIフレームワーク • Xcodeの機能の一部 • iOS, iPadOS, macOS,
watchOS, tvOS • Storyboardやリアクティブフレームワークを置き換える存在 • 宣言的シンタックスとデータ駆動が肝 ☝ 4
5 https://developer.apple.com/jp/xcode/swiftui/
6 SwiftUIの特長
宣言的シンタックス • Swiftの文法でUI構造を宣言的に記述できる 7
プレビュー • 画面サイズ,ダークモード,多言語,フォント設定などを 変えた複数の同時プレビューが可能 • ライブプレビューで動的な表現を確認 8
データの同期機構 • View間で同一データの参照 • データ駆動のリアクティブなUI定義 • 方法 • @Stateと@Binding •
Observableプロトコルと@ObservedObject • environmentObject()と@EnvironmentObject • environment()と@Environment 9 View @State var hoge = 42 View @Binding var hoge: Int bind
10 課題
Xcode11とCatalinaが不安定すぎる • Xcode11 • すぐクラッシュ,フリーズする,起動しなくなる • プレビュー,コード補完が効かなくなる • エラーメッセージが全くあてにならない •
Catalina • OS再起動中にフリーズしてハングアップする 11
SwiftUIのViewがまだ少ない • まだ基本的なViewしかない • 対応していないUIKitのViewクラスや機能は自前で実装が必要 • 自前実装することで宣言的UI,データ駆動に対応できる • SwiftUIに組み込む仕組みは提供されている 12
13 まとめ
まとめ • まだ安定性が低く,対応Viewも少ないが, AppleプラットフォームのUI開発が革新したのを感じた • jQueryからReact/Vueになったくらいの変革 • 再利用性の向上,複雑性の低下が期待できる 14
15 時間が余ればdemo マシンスペックが低いので遅いけど
16 Appendix
必要な環境 • macOS Catalina (10.15) • Mojaveでもビルドできるが,SwiftUIキャンバスは使えない • Xcode11 •
iOS13 17
利点 • View単位でテストデータをもとに表示やアクションや アニメーションなどを確認しながら開発できる • Viewのコンポーネント化がすごい簡単になった • UIの共同編集とdiffがしやすい (Storyboardは共同編集ができない) 18
Single Source of Truth (SSOT) • SwiftUIはSingle Source of Truthを実現する
• 正となる単一の情報源(ソースコード,データ)を持つ • 重複しない,コピーしない,同期処理が必要ない • SwiftUIにおいては • ソースコードが正(UIデザインツールとソースが一致している) • データが正(リアクティブなView更新) • イベント駆動実装に存在していた複雑性を大きく軽減できる 19
参考 • Xcode - SwiftUI - Apple Developer https://developer.apple.com/jp/xcode/swiftui/ •
SwiftUI Tutorials — Tutorials | Apple Developer Documentation https://developer.apple.com/tutorials/swiftui/tutorials • Data in SwiftUI, Part 1: Data | Sarun https://sarunw.com/posts/data-in-swiftui-1/ 20