Hi,
I have been discovering the RealmSwift SDK these past few days for a personal project. Currently, I am working on an iOS 16.0 app (SwiftUI) with Xcode 14.0 beta 4 and RealmSwift 10.28.2.
Right now, I am on a simple use case where I want to let users create lists, which are synced to their account with Realm Sync. I followed the quickstart on SwiftUI guide to manage the authentication flow. So in my models, I have a “NeoList” and “NeoListGroup” that has List (so similar to items/itemsGroup in the guide).
For a quick test to see if I can manage CRUD operations, I created first a main view that shows all the created lists by the user (with the new NavigationStack API in iOS 16.0):
var body: some View {
NavigationStack(path: $navigationPath) {
VStack {
List {
ForEach(neoListGroup.items) { item in
Text(item.title)
}
}
.navigationDestination(for: NeoListGroup.self) { group in
AddListView(group: group)
}
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {
navigationPath.append(neoListGroup)
}, label: {Image(systemName: "plus")})
}
}
.navigationTitle("My Lists")
}
}
When tapping on the + sign, the next view (AddListView) is pushed along with the group object so that I can append a new item:
struct AddListView: View {
@ObservedRealmObject var group: NeoListGroup
@State var title = "Title"
var body: some View {
VStack {
TextField("Title", text: $title)
Button("Send") {
$group.items.append(NeoList(title: self.title))
}
}
}
}
The code actually works, but I am getting a warning on Xcode related to a hang risk with one of the thread:
[…]/checkouts/realm-core/src/realm/util/interprocess_mutex.cpp:44: warning run: Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions
Thread Performance Checker: Thread running at QOS_CLASS_USER_INTERACTIVE waiting on a lower QoS thread running at QOS_CLASS_DEFAULT. Investigate ways to avoid priority inversions
So my question is: is there an issue with my code or is that somehow linked to the beta situation with Xcode/iOS 16?
Thanks a lot.