Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ロック画面Widgetをサクッと実装してみた話
Search
aoi
February 21, 2023
Programming
3
430
ロック画面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.6k
OS 固有の新機能をサービスに取り入れ活用していくための Tips
aomathwift
0
63
DocC Documentation Archiveをアプリ開発で活用してみよう / DocC Documentation Archive for iOS Application
aomathwift
0
620
即時通知を導入する際に考えるべきこと
aomathwift
0
4.9k
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話 After Talk
aomathwift
0
510
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話
aomathwift
1
10k
Other Decks in Programming
See All in Programming
Go製CLIツールをnpmで配布するには
syumai
2
1.1k
Advanced Micro Frontends: Multi Version/ Framework Scenarios
manfredsteyer
PRO
0
150
MySQL9でベクトルカラム登場!PHP×AWSでのAI/類似検索はこう変わる
suguruooki
1
280
Git Sync を超える!OSS で実現する CDK Pull 型デプロイ / Deploying CDK with PipeCD in Pull-style
tkikuc
4
520
リッチエディターを安全に開発・運用するために
unachang113
1
350
CIを整備してメンテナンスを生成AIに任せる
hazumirr
0
510
構造化・自動化・ガードレール - Vibe Coding実践記 -
tonegawa07
0
170
DynamoDBは怖くない!〜テーブル設計の勘所とテスト戦略〜
hyamazaki
0
180
PHPカンファレンス関西2025 基調講演
sugimotokei
6
1.1k
一人でAIプロダクトを作るならAIにはもっと働いてもらいたい / I want AI to work harder
rkaga
2
180
画像コンペでのベースラインモデルの育て方
tattaka
3
1k
Google I/O Extended Incheon 2025 ~ What's new in Android development tools
pluu
1
220
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
19k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
A better future with KSS
kneath
238
17k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Balancing Empowerment & Direction
lara
1
530
Java REST API Framework Comparison - PWX 2021
mraible
32
8.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
750
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
We Have a Design System, Now What?
morganepeng
53
7.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.4k
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 ಋೖͯ͠ϩοΫը໘Ͱͷଘࡏײ ⬆