Use for WidgetKit introduced in iOS 14 and macOS Catalyst 14
Questions tagged [widgetkit]
520 questions
-1
votes
1 answer
SwiftUI - weird spacing in HStack with two Texts
I am creating a "News" SwiftUI widget and I need to display rows, each containing time and news header.
I am using a VStack containing HStack's for each item but I am encountering an issue with extra HStack spacing between the two Text's. I need the…

ruslanosaur
- 11
- 4
-1
votes
1 answer
SwiftUI Widget: Text with DateStyle.relative - the seconds do not update in real time
When I create SwiftUI Widget with Text(_ : Date, style: DateStyle) using DateStyle.relative, and:
date 1hr 1 min from now - when it goes under 1 hr, to 59 min x sec, the seconds DO NOT update in real time
date 59 min from now - the seconds DO…

user14119170
- 1,191
- 3
- 8
- 21
-1
votes
1 answer
How to Embed Mapbox in iOS WidgetKit
I have been attempting to embed a mapbox view into an iOS widget using WidgetKit but am hung up on the following error:
Application extensions and any libraries they link to must be built with the APPLICATION_EXTENSION_API_ONLY build setting set to…

pennyowe
- 165
- 7
-1
votes
1 answer
In iOS Widgets, do you have to mark read-only data as @State?
Normally in SwiftUI, data which is owned by the view and used to render it is held in a private property marked with the @State property wrapper. This tells the system to track changes to that property so it knows when to update the view.
But... if…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
-1
votes
1 answer
Swift - Display value form API in widget and reload widget
Briefly explained; I am working on a project for my Tesla car. Tesla already has a widget that only can be added to the Today View tab, and that widget automatically refreshes when I swipe to to the today view. This is what it looks like: Image…

Erik Auranaune
- 1,384
- 1
- 12
- 27
-1
votes
1 answer
Is it possible to run WidgetKit code in iOS 13?
I'm creating a project that has a requirement of having a Widget.
My project is created using Xcode 12.4, the minimum iOS version supported by my iOS App is iOS 13, hence my App's target deployment iOS version is iOS 13.
Since WidgetKit is available…

Josh Byanec McFergan
- 441
- 8
- 21
-1
votes
1 answer
How can you import a Pods Framework in WidgetKit?
I am using Amplify, which I installed through cocoapods and it works fine in my "regular" iOS application in Swift.
I have now created a Widget Extension, inside of which I would also like to use Amplify.
I have tried adding Widget.swift to the main…

Florian S
- 552
- 3
- 15
-1
votes
1 answer
How to use Link in WidgetKit to define arbitrary regions, not just text links?
In the session "Widgets Code Along Part 2" in WWDC 2020, the presenter says:
Widgets do not have animation or custom interactions, but we can deep link from our widget into our app. SystemSmall widgets are one large tap area, while systemMedium and…

Tom Hamming
- 10,577
- 11
- 71
- 145
-2
votes
1 answer
Facing error in swift UI “Invalid frame dimension (negative or non-finite)” while drawing negative value in chart
In widget iOS14, I want to show values in graphical form using bar chart.
I have used this library "https://github.com/dawigr/BarChart" to draw bar chart.
But in Xcode12+, it's not showing negative values and considering negative value as 0 and…

Shipra Gupta
- 171
- 1
- 2
- 10
-3
votes
2 answers
Custom format for Text.DateStyle.timer?
Say I have a Text.DateStyle.timer in WidgetKit and I want to set it so that it displays hours:minutes only, instead of hours:minutes:seconds. How can I go about this?

David
- 87
- 12