Questions tagged [widgetkit]

Use for WidgetKit introduced in iOS 14 and macOS Catalyst 14

Docs: https://developer.apple.com/documentation/widgetkit

520 questions
4
votes
1 answer

How to prevent iOS 14 Widget opening app and react to callback

So, I already read several blogs, posts, and Apple's own Human Interface Guidelines that iOS 14 Widgets are NOT interactive, BUT: It's possible to pass a short link to the app when pressing on a target. Apple on its own says: "Small Widgets got one…
Rebar
  • 1,076
  • 10
  • 19
4
votes
1 answer

WidgetKit doesn't fetch updated data from Core Data when WidgetCenter.shared.reloadAllTimelines() gets called

The app uses Core Data + CloudKit. When the app gets launched WidgetKit fetches correct entries from Core Data but when I add new entries to Core Data from the main app and call WidgetCenter.shared.reloadTimelines() updated entries don't get fetched…
4
votes
1 answer

iOS 14 widget intents

I have a widget with a .intentdefinition file set up, and I can select from my enum when running my widget, but I'm not sure how to use this information in the code. What I want to be able to do is run different code in getTimeline based on what the…
Noah Evans
  • 309
  • 3
  • 12
4
votes
0 answers

How to reset user select option from configurable widget (ios14)

I'm making a configurable widget user can select an option from one of widgets and some point I want to reset that option. (for example, if user logout, user's option need to be reset.) I used func defaultMyType(for intent: MyTypeIntent) -> MyType?…
WoffOVkee
  • 435
  • 3
  • 16
4
votes
2 answers

WidgetKit on Mac with Intent doesn't work

I am trying to make a WidgetKit widget for macOS Big Sur. The widget itself works -- the same code on both the Mac and iOS. The issue is that on the Mac the intent (settings) does not work. When I click "Edit Widget" the options I defined do not…
Stephen Darlington
  • 51,577
  • 12
  • 107
  • 152
4
votes
1 answer

widgetURL is override inside Foreach?

I am displaying 3 rows in iOS 14 medium size widget like below: row 1 ------- row 2 ------- row 3 ------- my view structure is here: VStack { ForEach(records, id: \.id) { item in ZStack { // some views } …
Frank
  • 624
  • 9
  • 27
4
votes
3 answers

Widget in the app not appearing in the device?

We have a problem with adding the widget to the screen. Our app has 2 widgets and app is live in AppStore. The problem that some users can see only 1 widget (randomly, and using the newest version of the app), some see both widgets. It is hard to…
Jkrist
  • 748
  • 1
  • 6
  • 24
4
votes
3 answers

Can iOS14 widget requests main app to update its data?

my app needs latest data but, possibly, the main app has old data. so i want to request to the main app to update its data. is it possible? if it is not I would like to know any alternative way. (should the widget requests latest data to the…
WoffOVkee
  • 435
  • 3
  • 16
4
votes
1 answer

SwiftUI iOS14 Widget - Create create multi layout with the same WidgetFamily

When I add widgets from home screens, I can see that the Clock application created by Apple has two small WidgetFamily layouts. How to make two small Widgets like in the Clock application? I see that I only can create one layout for every…
Carson Vo
  • 476
  • 6
  • 20
4
votes
1 answer

How to change view on midnight in WidgetKit, SwiftUI?

I have a code: struct ContentView: View { let entry: LessonWidgetEntry private static let url: URL = URL(string: "widgetUrl")! var body: some View { VStack { switch entry.state { case .none: …
Jkrist
  • 748
  • 1
  • 6
  • 24
4
votes
2 answers

Localize iOS 14 dynamic widget configuration

I am trying to load different configuration for the widgets depending on the app language, but when I use something like: Locale.preferredLanguages Bundle.main.preferredLocalizations Bundle.main.localizations all of them are returning "en" only in…
FarouK
  • 740
  • 6
  • 17
4
votes
1 answer

SwiftUI, how to translate Text with timer style?

We are trying to create a iOS 14 widget, due to limitations in the API we are not able to use timers, however we discovered we can use a Text with a Date style that updates itself, however there is very little documentation available and the text…
Oscar Franco
  • 5,691
  • 5
  • 34
  • 56
4
votes
0 answers

Widget constantly reloads on device screen

I am using widget with CoreData and iCloud. They share the same App Group container. Everything works fine for a little, but spontaneously widget starts constantly reload and block itself on the device screen and in Widget Dashboard (place where you…
Lion
  • 1,264
  • 1
  • 17
  • 23
4
votes
0 answers

iOS 14 Widget is flickering or frozen, chronod crashing

I've implemented a Widget Extension (i.e. an iOS 14 widget, using WidgetKit) for my app. Ordinarily the widget works just fine, but occasionally it'll get into a state where it flickers repeatedly and eventually just freezes. I've tried connecting…
Jamie A
  • 881
  • 1
  • 6
  • 14
4
votes
1 answer

widgetURL in SwiftUI

What URL exactly we need to specify inside .widgetURL()? In WWDC sessions on Widget Code Along, They used .widgetURL(entry.character.url). Here entry.character.url is URL(string: "game:///egghead")! Please explain about URL we need to pass here…
Sai Durga Mahesh
  • 205
  • 2
  • 13