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
20201009 iOS 14 ウィジェットをつくってみた
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Kei Ito
October 09, 2020
Programming
2.5k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
20201009 iOS 14 ウィジェットをつくってみた
Kei Ito
October 09, 2020
More Decks by Kei Ito
See All by Kei Ito
20211015 Mac CatalystでmacOS用アプリを作る
itok
2
4.5k
20210219 Flutterに入門してみた
itok
1
4.1k
20191206 Property Wrappers 入門
itok
0
1.7k
20190920 iOS 13 対応ではまった話
itok
1
2.5k
20190726 Background App Refresh Taskがやってきた
itok
0
2.3k
20190722 Firebase Remote Configでアドネットワークを管理する
itok
0
1.6k
20190419 iOSアプリで証明書の情報を参照する
itok
0
1.5k
20190412 Android TV向けアプリを作ってみる
itok
0
1.1k
20190215 iOS/Androidでドキュメントスキャナーを作ってみた
itok
0
1.8k
Other Decks in Programming
See All in Programming
net-httpのHTTP/2対応について
naruse
0
490
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
140
Lessons from Spec-Driven Development
simas
PRO
0
200
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
11
4.1k
The NotImplementedError Problem in Ruby
koic
1
790
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
790
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.2k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
140
ふつうのFeature Flag実践入門
irof
7
4k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
200
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
Featured
See All Featured
The Limits of Empathy - UXLibs8
cassininazir
1
360
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.7k
Design in an AI World
tapps
1
240
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
410
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Transcript
J04ΟδΣοτΛ ͭͬͯ͘Έͨ .PCJMF"DU0/-*/& JUPL!ͦΒ͔ͥ
JUPL!ͦΒ͔ͥ w ͍ͱ͏͚͍ʢJUPLʣ w ɹɹɹɹɹɹͷதͷਓ w ϞόΠϧΞϓϦΤϯδχΞ݉$&0 w ෭ۀͰϑϦʔϥϯεత w
IUUQTJUPLKQ IUUQTTPSBLB[FDPKQ !JUPLKQ
ॴࡏɿژࢢதژ۠ ࣾһਓࣗ
࣮ डୗ ࣗࣾ
J04"OESPJENBD048JOEPXTαʔό ҰਓͰͬͯ·͢ʢσβΠϯҎ֎ʣ
iOS൛ v10.0.0
None
J04 ΟδΣοτΛ ͭͬͯ͘Έͨ
·ͣҙࣄ߲
4XJGU6*ඞਢ
6*,JU͑·ͤΜ
6*7JFX3FQSFTFOUBCMFΛ ͏ͱ͜͏ͳΔ
ࢀߟ w 88%$ w 8JEHFU,JUʹ͍ͭͯ w 8JEHFU$PEF"MPOHʙ
ΟδΣοτͷछྨ
TNBMM NFEJVN MBSHF ֎ݟ ૢ࡞ શମλοϓͷΈ શମ ҙͷྖҬλοϓ
ૢ࡞ w શମλοϓ w ҙͷྖҬλοϓ { }.widgetURL(url) Link(destination: url) {
}
جຊߏ 8JEHFU 8JEHFU$POpHVSBUJPO 5JNFMJOF1SPWJEFS 7JFX 5JNFMJOF&OUSZ
جຊߏ struct MyWidget: Widget { public var body: some WidgetConfiguration
{ StaticConfiguration(kind: kind, provider: MyProvider()) { entry in MyWidgetEntryView(entry: entry) } } } struct MyProvider: TimelineProvider { func getTimeline(in context: Context, completion: @escaping (Timeline<MyEntry>) -> Void) { ... completion(Timeline(entries: entries, policy: .atEnd)) } } struct MyWidgetEntryView : View { var entry: MyEntry var body: some View { ... } }
ઃఆʢTUBUJDʣ͋Γ 8JEHFU 8JEHFU$POpHVSBUJPO *OUFOU 7JFX 5JNFMJOF&OUSZ 5JNFMJOF1SPWJEFS
ઃఆʢEZOBNJDʣ͋Γ 8JEHFU 8JEHFU$POpHVSBUJPO *OUFOU 7JFX 5JNFMJOF&OUSZ 5JNFMJOF1SPWJEFS *OUFOU&YUFOTJPO
ઃఆ͋Γ struct MyWidget: Widget { public var body: some WidgetConfiguration
{ IntentConfiguration(kind: kind, intent: MySelectionIntent.self, provider: MyIntentProvider()) { entry in MyWidgetEntryView(entry: entry) } } } struct MyIntentProvider: IntentTimelineProvider { func getTimeline(for configuration: MySelectionIntent, in context: Context, completion: @escaping (Timeline<MyEntry>) -> Void) { ... completion(Timeline(entries: entries, policy: .after(date))) } }
IntentHandler.swift class IntentHandler: INExtension, MySelectionIntentHandling { func provideParameterOptionsCollection( for intent:
MySelectionIntent, with completion: @escaping (INObjectCollection<MyType>?, Error?) -> Void) { completion(INObjectCollection(items: items), nil) } *OUFOU&YUFOTJPO .Z4FMFDUJPOJOUFOUEFpOJUJPO
ߋ৽ public struct TimelineReloadPolicy : Equatable { // entries͕શ෦ऴΘͬͨΒߋ৽ public
static let atEnd: TimelineReloadPolicy // ߋ৽͠ͳ͍ public static let never: TimelineReloadPolicy // ࢦఆ࣌ؒʹߋ৽ public static func after(_ date: Date) -> TimelineReloadPolicy } // ΞϓϦଆ͔Βߋ৽Λଅ͢͜ͱ WidgetCenter.shared.reloadAllTimelines() ࣮ࡍͷߋ৽λΠϛϯά ࠷ऴతʹ04͕͍͍ײ͡ʹௐ͢ΔͷͰҙ
ෳΟδΣοτ 8JEHFU#VOEMF 8JEHFUᶄ 8JEHFUᶃ *OUFOU&YUFOTJPO @main struct Bundle: WidgetBundle {
@WidgetBundleBuilder var body: some Widget { Widget1() Widget2() } }
͍͞͝ʹ w ΟδΣοτରԠ͍ͯ͜͠͏ʂ w ͰΞϓϦຊମͷ༠ಋେࣄʁʢϏδωεతʹʣ w ΄ͲΑ͍ใͷόϥϯε۩߹ΛݟۃΊͯ