This issue has been resolved today. The new Beta 4 version of iOS 18.1 finally works on old devices as well.
Post
Replies
Boosts
Views
Activity
SwiftData still have serious issues, specially when working with CloudKit (iOS 18 Beta). One of the issues I was able to identified is that the views do not update when relationships change. You can see all the values in an object except the values in the relationships (they are nil), but if I force an update on the view, the values show up. I hope they come up with a solution before release, otherwise SwiftData will be completely useless.
I checked and get the same error. The only issue I found with your code is that you declared the property with @State but you should have declared it with @Bindable. But I tried and keep getting the error. It has to be a bug. The only solution was to manage the selection from a @State property (@State private var envProfile: String?)
In Beta 7, all the properties need a default value or be optional.
@Model public class Product {
public var id:UUID = UUID()
public var name: String = ""
//relationship
public var category:Category?
public init(name: String){
self.name = name
}
It is a bug. In Beta 3 it was possible to embed the preview code in MainActor.assumeIsolated { }, but this patch no longer works in Beta 4. They are now recommending to run the SwiftData apps in the simulator or a device until they fix the bug.
Same problem. I couldn't find any solution. The macro uses PredicateExpressions enumerations to build the predicate. The enumeration includes a lot of methods but none seems to work for case insensitive searches. I hope they fix this soon or SwiftData becomes completely useless for most cases.
Not sure if it is related, but none of the examples about SwiftData work anymore in Beta 3. They are all broken. I'm getting the error "unsafeMutableAddressor of self" all the time. Maybe it was released ahead of schedule?
The most elegant solution I've found is to extract the view and pass the model to a @Bindable property.
@Observable
final class View1Model {
var text: String = ""
}
struct View1: View {
@State var viewModel = View1Model()
var body: some View {
View2()
.environment(viewModel)
}
}
struct View2: View {
@Environment(View1Model.self) var viewModel
var body: some View {
View3(viewModel: viewModel)
}
}
struct View3: View {
@Bindable var viewModel: ViewModel
var body: some View {
TextField("Text", text: $viewModel.text)
}
}
I've found the same issue. Deselection still doesn't work in Beta 4. I'm worry.
The NavigationSplitView works with List selection, and the NavigationLink must include the label and a value. The new process is explained here
https://developer.apple.com/videos/play/wwdc2022/10054/
Although it works, there is an issue with the view at the moment. If you use an if else or a switch to select the view to show in Detail, it doesn't work. The solution for now is to embed it in a ZStack, as explained in this post
https://developer.apple.com/forums/thread/707924
I solved all the issues by replacing the NSSortDescriptor class by the SortDescriptor structure.
Do you know a better way to create the persistent store for the previews? I tried other approaches but the previews always crashes.
I have the same problem in Xcode 13.2. The only solution was to uninstall the 13.2 version and install the 13.1 version again. Very annoying.
I have the same issue with my Mac Mini M1. It stops scrolling on browsers and it starts jumping around on other applications. I filed a bug report. I hope they fix it for the final release because it makes the Magic Trackpad useless. Here is a quick video I made to show the problem. At first, it seems to work but then stops scrolling and fails two or three more times. It keeps failing every three or four attempts or every four or five seconds. I tried everything, but nothing solves the issue. It looks like a bug in Monterrey.
https://www.youtube.com/watch?v=OxhW7biM5m0
I got it. The option is in the Apple ID panel now.
Thanks