Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ロック画面Widgetをサクッと実装してみた話
Search
aoi
February 21, 2023
Programming
3
450
ロック画面Widgetをサクッと実装してみた話
https://potatotips.connpass.com/event/272353/
aoi
February 21, 2023
Tweet
Share
More Decks by aoi
See All by aoi
モバイルアプリの行動ログの運用つらさ解消法 / mobile-log-troubleshooting
aomathwift
3
2.7k
OS 固有の新機能をサービスに取り入れ活用していくための Tips
aomathwift
0
65
DocC Documentation Archiveをアプリ開発で活用してみよう / DocC Documentation Archive for iOS Application
aomathwift
0
640
即時通知を導入する際に考えるべきこと
aomathwift
0
5.5k
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話 After Talk
aomathwift
0
530
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話
aomathwift
1
11k
Other Decks in Programming
See All in Programming
マスタデータ問題、マイクロサービスでどう解くか
kts
0
130
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
450
AIコーディングエージェント(NotebookLM)
kondai24
0
240
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
230
クラウドに依存しないS3を使った開発術
simesaba80
0
170
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
4.1k
JETLS.jl ─ A New Language Server for Julia
abap34
2
460
Graviton と Nitro と私
maroon1st
0
140
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
380
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
140
re:Invent 2025 トレンドからみる製品開発への AI Agent 活用
yoskoh
0
440
Deno Tunnel を使ってみた話
kamekyame
0
250
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
170
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
270
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
300
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
400
Statistics for Hackers
jakevdp
799
230k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
66
[SF Ruby Conf 2025] Rails X
palkan
0
640
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Writing Fast Ruby
sferik
630
62k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Transcript
ϩοΫը໘ Widget ΛαΫοͱ࣮ͯ͠Έͨ Aoi Okawa (@aomathwift) 2023/02/21 potatotips #81
ϩοΫը໘ Widgetʁ
ϩοΫը໘ Widget ͱ • iOS 16 ͔Β͑ΔϩοΫը໘ ΧελϚΠζػೳͷҰ෦ • AppleWatch
ͷίϯϓϦέʔ γϣϯͷΑ͏ͳ Widget
৽͍͠ WidgetFamily accessory Circular accessory Rectangular accessory Inline
࣮ํ๏ @main struct CookpadMartWidget: Widget { var body: some WidgetConfiguration
{ StaticConfiguration( kind: "DefaultWidget", provider: Provider() ) { entry in EntryView(entry: entry) } .supportedFamilies([.systemSmall, .accessoryCircular]) // ... } }
࣮ํ๏ struct EntryView : View { @Environment(\.widgetFamily) var family var
entry: Provider.Entry var body: some View { switch family { case .systemSmall: SmallView(entry: entry) case .accessoryCircular: CircularView(entry: entry) // ... @unknown default: Text("default") } } }
Cookpad Mart ͷ Widget ػೳ طʹಋೖࡁΈ🎉
ϩοΫը໘ Widget αΫοͱಋೖͰ͖ͦ͏💡
• accessoryRectangular ͱ accessoryCircular ͷ 2αΠζΛαϙʔτ • iOS Ͱͷར༻ͷΈΛఆ ࣮ͯ͠Έͨ
ಋೖͯ͠Έͨॴײ
• දࣔͰ͖Δใྔ͕ϗʔϜը ໘ Widget ʹൺͯগͳ͍ • ΞϓϦΛىಈ͢Δಈઢͱͯ͠ ͷ׆༻ʹৼΓΔͷ༗Γ දࣔίϯςϯπͷ͠͞
Inline ෆ࠾༻ • Rectangular Ҏ্ʹڝ૪͕ߴ͍ʢ1ͷΈʣ • ͷྡʹઃஔ͞ΕΔͷͰใ͕ຒΕ͍͢ ϚʔτΞϓϦͰड͚औΓ༧ఆΛදࣔ ͠Α͏ͱ͕ͨ͠ɺ࣌ࠁͷ্ʹ͕ೋͭ ฒͿͱ͍͏ݟ͕ͨෆࣗવա͗ͯ🥲
ར༻͞ΕͯΔʁ accessoryRectangular Λઃஔ͍ͯ͠ΔϢʔβʔͷׂ߹ 0.018% accessoryCircular Λઃஔ͍ͯ͠ΔϢʔβʔͷׂ߹ 0.10% (ࢀߟ) systemMedium Λઃஔͯ͠ΔϢʔβʔͷׂ߹
0.045% (ࢀߟ) systemSmall Λઃஔ͍ͯ͠ΔϢʔβʔͷׂ߹ 0.098%
ͬͯΒ͏ͷ͕͍͠ • ػೳͷଘࡏࣗମ͕ೝ͞Εʹ͍͘ • ͷڝ૪͕ߴ͗͢Δ • શ෦ͷαΠζ߹Θͤͯ࠷େͰ̑ • ݱঢ়ͷ͕ଟ͍ํ͕ͬͯΒ͑ͯΔ
Widget ར༻ͷϩάͷऔΓํ • WidgetCenter.getCurrentConfigurations • ઃஔ͞ΕͯΔ WidgetFamily ͕ྻͰฦΔ • ΞϓϦ͕ΞΫςΟϒʹͳΔʹ࠷৽Λૹ৴
ࠓޙͷ՝ • ػೳͷଘࡏͷೝΛ্͛Δ • ίϯςϯπͷϒϥογϡΞοϓ • LiveActivity ಋೖͯ͠ϩοΫը໘Ͱͷଘࡏײ ⬆