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
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.7k
20190419 iOSアプリで証明書の情報を参照する
itok
0
1.6k
20190412 Android TV向けアプリを作ってみる
itok
0
1.1k
20190215 iOS/Androidでドキュメントスキャナーを作ってみた
itok
0
1.8k
Other Decks in Programming
See All in Programming
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
130
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
3.3k
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
200
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
200
FDEが実現するAI駆動経営の現在地
gonta
2
250
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
240
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
420
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
360
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
980
torikago - Ruby::Boxで照らすモジュラモノリスの実行境界
se4weed
1
310
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
200
数百円から始めるRuby電子工作
tarosay
0
120
Featured
See All Featured
Unsuck your backbone
ammeep
672
58k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.2k
Designing Powerful Visuals for Engaging Learning
tmiket
1
470
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
650
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
420
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
New Earth Scene 8
popppiees
3
2.4k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
41k
Google's AI Overviews - The New Search
badams
0
1.1k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
280
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 ΄ͲΑ͍ใͷόϥϯε۩߹ΛݟۃΊͯ