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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
aoi
February 21, 2023
Programming
470
3
Share
ロック画面Widgetをサクッと実装してみた話
https://potatotips.connpass.com/event/272353/
aoi
February 21, 2023
More Decks by aoi
See All by aoi
モバイルアプリの行動ログの運用つらさ解消法 / mobile-log-troubleshooting
aomathwift
3
2.9k
OS 固有の新機能をサービスに取り入れ活用していくための Tips
aomathwift
0
82
DocC Documentation Archiveをアプリ開発で活用してみよう / DocC Documentation Archive for iOS Application
aomathwift
0
670
即時通知を導入する際に考えるべきこと
aomathwift
0
6k
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話 After Talk
aomathwift
0
550
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話
aomathwift
1
11k
Other Decks in Programming
See All in Programming
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
430
Claspは野良GASの夢をみるか
takter00
0
160
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
130
3Dシーンの圧縮
fadis
1
590
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
800
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
5.6k
初めてのRubyKaigiはこう見えた
jellyfish700
0
410
今さら聞けないCancellationToken
htkym
0
220
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
440
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
3
2k
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
180
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.3k
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The browser strikes back
jonoalderson
0
1.1k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
190
Embracing the Ebb and Flow
colly
88
5.1k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
400
Facilitating Awesome Meetings
lara
57
6.9k
The Pragmatic Product Professional
lauravandoore
37
7.3k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.2k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
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 ಋೖͯ͠ϩοΫը໘Ͱͷଘࡏײ ⬆