Use for WidgetKit introduced in iOS 14 and macOS Catalyst 14
Questions tagged [widgetkit]
520 questions
0
votes
1 answer
Pass UIKit Storyboard Data in to Widget with UserDefault
How to pass UIkit data in to widget extension and also get data in widget from User Default?
Second question is I have show dummy data in widget but getTimeline function only show first timeline other timelines not showing?
func getTimeline(in…

Guggz Dhiman
- 1
- 1
0
votes
1 answer
How to choose image in App and show in Widget
I'm trying to find a suitable mechanism to provide an image from the app to the widget. So far I had success with AppGroups and a fixed identifier. Saved the image in user defaults with a fixed ID on the app side and I could retrieve it on the…

Nico S.
- 3,056
- 1
- 30
- 64
0
votes
1 answer
WidgetKit proper placeholders
I'm having troubles on figuring out proper placeholders for WidgetKit. The issue I'm having is I'm not sure how to set say a default value for Codable data, I attempted but it's not showing any data in my placeholder view. I would like my…

cole
- 1,039
- 1
- 8
- 35
0
votes
1 answer
WidgetKit not work for an Intent Handler to Provide Dynamic Values
I am trying to implement a widget where the user can choose a city dynamically via an intent.
I followed the step by step guide provided by apple here:
https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget
I think I have…

Salvatore Milazzo
- 25
- 6
0
votes
0 answers
Error while running widgetkit extension target on physical device
Added a WidgetBuilder to my extension so I could include a second type of widget for my app. I keep getting this error in a popup when building it onto my device.
Details
SendProcessControlEvent:toPid: encountered an error: Error…

Arnav Motwani
- 707
- 7
- 26
0
votes
0 answers
Do I have to archive a build for my app and widgetkit extension separately to share with TestFlight?
I just finished up my widget and I want to archive it for TestFlight however I cannot find the answer on how i'm supposed to build the app and the widgetkit extension? Do I first select the app target and archive then the widget target and archive…

Arnav Motwani
- 707
- 7
- 26
0
votes
1 answer
iOS14.5 Widget data not up-to-date
I use the following code to update my widget's timeline, but the "result" which I fetched from the core data is not up-to-date.
My logic is when detecting the host app goes to background I call "WidgetCenter.shared.reloadAllTimelines()" and fetch…

Yu23333
- 46
- 5
0
votes
0 answers
How to use dynamic date in widget SwiftUI/WidgetKit
Im using a Text view to show a remaining time to a date like so:
Text(entry.remainingTime, style: .relative)
it works but when the timer reaches 0 it start again increasing, which is good for me I just need to know the counter reached 0 so I can…

B. Mohammad
- 2,152
- 1
- 13
- 28
0
votes
1 answer
Sharing files in FileManager or App target to a WidgetExtension target
I have a json file stored in the FileManager of my app and I want to access and decode it for my widget. I use the following url for the file:
let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
…

Arnav Motwani
- 707
- 7
- 26
0
votes
0 answers
Decoding json from FileManager - WidgetKit
My app runs off json for persistent data and i'm trying to use that stored data in my widget.
In my app I use this function to load my data from the FileManager into and ObservableObject like this
class jsonData: ObservableObject {
@Published…

Arnav Motwani
- 707
- 7
- 26
0
votes
1 answer
CoreLocation WidgetKit
I'm having troubles getting CoreLocation working in WidgetKit. I was able to do so using an ObservableObject class in a SwiftUI app just fine. Now I'm not sure how to do so with a widget.
I added LocationManager to my TimelineEntry and then called…

cole
- 1,039
- 1
- 8
- 35
0
votes
1 answer
How to Deep Link Widget with data pulled from Core Data?
I'm trying to get deep linking working for my app's widgets. The widgets simply display an image from a Core Data entity: Project. I'd like for when a user taps on the widget, it opens up the ProjectDetailView() that the image is a member…

phiredrop
- 182
- 1
- 11
0
votes
0 answers
How to get Google login in iOS widget extension
I'm trying to build an app with a widget using GoogleAPIClientForREST and GoogleSignIn. WidgetKit is very limited to check for new data and I've seen the onBackgroundURLSessionEvents in WidgetConfiguration. As far as understand I need to make my…

Nico S.
- 3,056
- 1
- 30
- 64
0
votes
1 answer
SwiftUI/Widget - Why the `Text` for `Date` takes so much space in HStack
Why the Text for Date takes so much space.
var body: some View {
VStack{
HStack(alignment: .top, spacing: 0) {
VStack{
Text(entry.date, style:.relative)
}
.background(Color.yellow)
…

Kesong Xie
- 1,316
- 3
- 15
- 35
0
votes
2 answers
SwiftUI combine nil data
I have created a class to perform a network request and parse the data using Combine. I'm not entirely certain the code is correct, but it's working as of now (still learning the basics of Swift and basic networking tasks). My Widget has the…

cole
- 1,039
- 1
- 8
- 35