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
390
ロック画面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.3k
OS 固有の新機能をサービスに取り入れ活用していくための Tips
aomathwift
0
44
DocC Documentation Archiveをアプリ開発で活用してみよう / DocC Documentation Archive for iOS Application
aomathwift
0
520
即時通知を導入する際に考えるべきこと
aomathwift
0
4.1k
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話 After Talk
aomathwift
0
460
機能ごとに動作するミニアプリでプレビューサイクルを爆速にした話
aomathwift
1
9.4k
Other Decks in Programming
See All in Programming
RubyLSPのマルチバイト文字対応
notfounds
0
120
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
230
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
CSC509 Lecture 11
javiergs
PRO
0
180
Jakarta EE meets AI
ivargrimstad
0
140
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
みんなでプロポーザルを書いてみた
yuriko1211
0
260
役立つログに取り組もう
irof
28
9.6k
最新TCAキャッチアップ
0si43
0
140
Featured
See All Featured
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Navigating Team Friction
lara
183
14k
The Cult of Friendly URLs
andyhume
78
6k
Typedesign – Prime Four
hannesfritz
40
2.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Thoughts on Productivity
jonyablonski
67
4.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The World Runs on Bad Software
bkeepers
PRO
65
11k
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 ಋೖͯ͠ϩοΫը໘Ͱͷଘࡏײ ⬆