Converting
class Model: ObservableObject {
@AppStorage("prop0") var prop0 = 0
}
to
@Observable struct Model {
@AppStorage("prop0") var prop0 = 0
}
created error: Property wrapper cannot be applied to a computed property
How can properties of @Observable models be saved in user defaults?
Post
Replies
Boosts
Views
Activity
In SwiftUI, how to display a [Link<Text>]?
In iOS 16 beta 3, my iOS app sets some strings in the shared user defaults of the app group. The iOS widget extension reads the strings from the shared user defaults correctly, but the watchOS app and watchOS widget extension could not read them (get nil). Integers stored in the shared user defaults can be read everywhere. All targets are in the same app group. Does anyone have similar problems?
How to create a chart where each data mark has a color based on its value? Like this chart: https://observablehq.com/@d3/gradient-encoding
With the following code, the whole curve has one color only. My function Color.forTemperature() returns different colors for different temperatures.
Chart(temperatures) { temperature in
LineMark(
x: .value("Day", temperature.date, unit: .day),
y: .value("Temperature", temperature.value)
)
.foregroundStyle(Color.forTemperature(temperature.value))
}
After updating to NavigationStack with nested navigation links (with navigation links in a navigation destination), I see a lot of warnings in Xcode 14 beta:
Update NavigationAuthority bound path tried to update multiple times per frame.
Update NavigationAuthority possible destinations tried to update multiple times per frame.
The app often freezes when navigated with a NavigationLink. Do others see these problems?
It seems an overlay is limited to the size of the base view. How to remove the limit?
baseView.overlay {overlayView}
How to enable developer mode on Apple Watch with watchOS 9 beta?
How to get current time in a widget (like the builtin clock widget), to update the widget based on the current time, since a widget is supposed to provide timely info?
I'm trying to measure light quality with the camera, not to capture good looking photos. How do I get raw camera sensor data, without processing such as white balance? If I lock white balance mode when setting up capture session as following, will white balance be turned off during the session?
if device.isWhiteBalanceModeSupported(.locked) {
device.whiteBalanceMode = .locked
}
When testing an auto-renewable subscription with StoreKit 2 in Xcode 13 beta 3, the purchase transaction revocationDate is 2001-01-01, which prevents the app to verify the subscription. It should be nil, since there is no simulation of refunding or revocation in the test. Is it a bug in StoreKit 2?
How to block a sender in iMessage in iOS 15?
The requestReview() method of SKStoreReviewController is deprecated in iOS 14 beta. There is a new requestReview(in windowScene: UIWindowScene), but with the App structure in SwiftUI, there is no UIWindowScene. How to request app review?
It's recommended to add a transaction observer to the payment queue on app launch, in the app delegate method. With the new App structure in iOS 14, where should the transaction observer be added?
In Providing Data for Your Complication: When the user first places your complication on the active watch face, ClockKit asks for the complication’s initial set of timeline entries. After that, however, it doesn’t typically request additional timeline entries until you explicitly update your timeline.In Creating a Timeline Entry: ClockKit periodically requests timeline entries from your complication’s data source, both to load the current timeline entry and to batch load future timeline entries.They are contradictory. Which is true?