Post

Replies

Boosts

Views

Activity

How to detect always-on display in Swiftui?
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)
1
0
1.1k
Jul ’23
How can widget be updated every half a second?
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.
2
0
2.4k
Jul ’23
Has anyone figured out how to use the "bump" gesture for airdrop or shareplay?
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?
3
1
2k
Jun ’23