All Questions
3
questions
0
votes
2
answers
883
views
SwiftData sorting order of Query array elements
I have a simple test app with a behavior I just don't understand.
import SwiftUI
import SwiftData
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@Query ...
4
votes
1
answer
848
views
Sort SwiftData Query shown in SwiftUI Table on macOS
I have a mini macOS app, presenting some data persisted in SwiftData on a Table.
I want to sort the data by clicking on Table's column headers so I have a KeyPathComparator on the table.
But since the ...
0
votes
2
answers
316
views
Why can't I change the order of the model's array?
I'm currently programming my first SwiftData app.
I created two models:
Player.swift:
@Model
final class Player {
@Relationship(inverse: \Game.players) var games: [Game]
var name: String
...