Questions tagged [widgetkit]

Use for WidgetKit introduced in iOS 14 and macOS Catalyst 14

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

520 questions
5
votes
2 answers

Is there a way to solve the iOS 14 Widget flicker issue?

I'm experiencing a strange graphic issue (flickering) for iOS 14 widgets on the Home Screen and also in the Widget Gallery. The problem seems to occur after an app update gets installed. During development I thought this is a problem with the iOS…
d03090
  • 354
  • 1
  • 5
  • 17
5
votes
1 answer

iOS 14 Medium Widget Size Background Image Refuses to Fill

For some reason I'm unable to get an image background to aspectFill correctly in XCode Version 12.0, but only on the .systemMedium widget size. It seems to work perfectly on the small and large sizes. I've got a pretty simple View: import…
5
votes
1 answer

Setting the TimelineProvider refresh interval for Widget

Right now my Widget makes about 1 request per second. I want to change it to 1 request in 1 hour. I get some errors on the line with let timeline = ... like Value of optional type 'Date?' must be unwrapped to a value of type 'Date' and some…
submariner
  • 308
  • 1
  • 5
  • 23
5
votes
2 answers

How to change the color of the widget center ‘Add Widget’ button

Some apps have changed the color of the ‘Add Widget’ button. How can I change the color of the button?
kjg
  • 157
  • 6
5
votes
3 answers

WidgetKit getCurrentConfigurations returns wrong list of widget-configurations

I've added Widget Extension with Configuration Intent. For the logging purposes, I've tried to log number of widgets user of the app has WidgetCenter.shared.getCurrentConfigurations { results in guard let widgets = try? results.get() else {…
Konstantin Loginov
  • 15,802
  • 5
  • 58
  • 95
5
votes
1 answer

XCode 12: No persisted cache on this platform

I am trying to develop an iOS 14 Widget in Simulator but each time I run the app I get the below warning. MobileGestaltCache.c:38: No persisted cache on this platform. This however breaks nothing but not sure how to fix this.
Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62
4
votes
5 answers

How to add AppIntent to app target and use it in an interactive widget

How do you create an AppIntent that will run in your app's process and use it in your widget's Button? I created a new file, added it to my app's target, created my AppIntent struct, then added a button to my widget: Button(intent: TestIntent()) {…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
4
votes
2 answers

Multiple function calls, but single execution of async Task

I am playing around with Apple's new WeatherKit + WidgetKit. Unfortunately I can't seem to find a solution for the combination of the following three problems: WidgetKit requires to load all data in the getTimeline function (no dynamic updating of…
Mike
  • 99
  • 6
4
votes
1 answer

WidgetKit (Intent) - How to link multiple dynamic intents fetched from remote?

I'm creating a widget for my application and successfully added intent configuration with dynamic data that I got from API. This snippet gets the list and returns it to Intent: func provideLeagueOptionsCollection(for intent:…
oğuz
  • 145
  • 1
  • 13
4
votes
1 answer

WidgetKit doesn't work in Simulator on M1, any ideas?

Create a SwiftUI app on an M1 machine Run it on simulator Create a Widget Extension target Try to run it in simulator. I get this error: 2021-10-27 15:35:36.959366-0300 EmojiWidgetExtension[9771:1239405] [db] _LSSchemaConfigureForStore failed with…
Lio
  • 4,225
  • 4
  • 33
  • 40
4
votes
2 answers

iOS WidgetKit cannot load certain Image

I have my images Assets.xcassets, and try to load it in my Widget View. To use images in widget too, I already set target membership for widget extension. But the problem is it cannot load certain images (ex. HalloweenOne, HalloweenTwo,…
naljin
  • 439
  • 3
  • 10
4
votes
0 answers

WidgetKit preview stopped working after switching to M1 Apple silicon

Have recently switched to M1 Macbook Pro. The project I've been working on stopped previewing the WidgetKit extension file (for other swiftui files preview works as intended). Xcode on my previous machine (not M1) previews the WidgetKit file well.…
4
votes
1 answer

How to refresh multiple timers in widget iOS14?

I'm currently developing an application using SwiftUI and trying to make a widget iOS 14 users can check a list of timers. This Widget has multiple Text(Data(),style: .timer) to show some date data as timer. and when the rest of the value for the…
Tio
  • 944
  • 3
  • 15
  • 35
4
votes
0 answers

How to reload fetch data from coredata in Intent Handler when host App close?

I'm currently developing an application using SwiftUI. I want to reload data from CoreData in IntentHandler to update newer data every when I close a host App. In the case of Widget, we can use WidgetCenter.shared.reloadAllTimelines() to update, but…
Tio
  • 944
  • 3
  • 15
  • 35
4
votes
2 answers

Multiple ui elements break WidgetExtension

I'm trying to dynamically build a view using SwiftUI for my widget. However, when multiple views are stacked, the widget no longer works. I want to loop my Widget over an array of fetched data, like so: VStack { ForEach(entry.layers.indices) {…
Kipnoedels
  • 1,118
  • 7
  • 22