I was debugging my widget in iOS 17.0 (21A5312c)
It is constantly crashing in getTimeline when calling completion(timeline)
The same code was working in previous betas.
I've checked the debugger, neither completion nor timeline is nil but I get a EXC_BAD_ADDRESS crash
As a result the widgets are always white.
How to fix?
Post
Replies
Boosts
Views
Activity
According to apple
On devices that include an Always-On display, the system dims the
screen to preserve battery life and renders Live Activities on the
Lock Screen as if in Dark Mode. Use SwiftUI’s isLuminanceReduced
environment value to detect reduced luminance on devices with an
Always-On display and use images that look great for reduced
luminance.
But it seems to have no effect in live activities when displayed in the lock screen with AOD
@Environment(\.isLuminanceReduced) var isLuminanceReduced
Image("background1")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 400)
.offset(y:-40)
.brightness(isLuminanceReduced ? -0.5 : 0)
How do you animate in live activities?
I've seen apps been able to update around 1 fps. For example with a character looping a dance animation.
How is this done?
I don't think you can call Activity.update() every second. Also it wouldn't run in the background all the time anyway?
Here's an example of Apple's own WWDC video with a bar animating
https://imgur.com/a/yywW7a8
Many widgets running on iOS 16 is able to update their UI as frequent as half a second or one second.
How is this done?
You have a limited with timeline refreshes (every 15-30 minutes at most) https://developer.apple.com/documentation/widgetkit/keeping-a-widget-up-to-date
A widget’s budget applies to a 24-hour period. WidgetKit tunes the 24-hour window to the user’s daily usage pattern, which means the daily budget doesn’t necessarily reset at exactly midnight. For a widget the user frequently views, a daily budget typically includes from 40 to 70 refreshes. This rate roughly translates to widget reloads every 15 to 60 minutes, but it’s common for these intervals to vary due to the many factors involved.
You also cannot supply a long list of entries (in my test, something beyond 400 Entries in the timeline causes the widget to not update)
Also, the View itself cannot be update every second either even your Entries are 1 second apart. The UI seems to be update every 2 second at the fastest and ignore in between entries.
I'm trying to provide dynamic options to a widget and my IntentHandler: INExtension is called correctly. However, inside provide*OptionsCollection function, I want to be able to print to console and debug that function. How can one do that?
Where is the sample app for taco order?
According to the keynote:
"And we're also using this same gesture to make it easier than ever to AirDrop content, and even kick off shared experiences"
also in this wwdc session https://developer.apple.com/wwdc23/10239 06:58, it showed that you can start a shareplay session by just bumping.
There's no mention of this in the API, how does one do this?
I have
VStack {
}
.background(Color.gray)
.border(.red)
.toolbar {
//items
}
For some reason the toolbar goes grey as well. Why? The border clearly shows that the VStack doesn't extend to behind the toolbar.
https://imgur.com/O0CCcFJ