XCode 15 beta 6.
Just want to do a very simple Query Predicate where the relationship model matches:
@Query(
    filter: #Predicate<Piece> {
        $0.artist == selectedArtist
    },
    sort: [
        SortDescriptor(\Piece.age, order: .reverse)
    ]
) var pieces: [Piece]
and I'm receiving error:
Cannot convert value of type 'PredicateExpressions.Equal<PredicateExpressions.KeyPath<PredicateExpressions.Variable, Artist>, PredicateExpressions.Value>' to closure result type 'any StandardPredicateExpression'
I also tried .id and .persistentModelId on the artist but no luck.
This seems like the most basic predicate use case so I'd be shocked if it's not supported. Any ideas what i'm missing?
My models are basic:
@Model
final class Piece {
    var age: Int
    var artist: Artist
}
And
@Model
final class Artist {
    var name: String
    
    @Relationship(
        deleteRule: .cascade, 
        inverse: \Piece.artist
    )
    var pieces: [Piece]?
}

Pieceentries, onArtist.piecesso what's the need for a separate query? In my case, myPiecesitems were going to vastly outnumber myArtistitems, so filtering every single Piece in order to find relevant ones was not the way to go. I'd be curious to learn more about what you were trying to do?let newPiece = Piece()→modelContext.insert(newPiece)→piece.artists.append(artist)) — which were instructions I had found elsewhere. INSTEAD the correct approach is somewhat counterintuitive: with SwiftData you can create the object and simply amend the parent and it works: (let newPiece = Piece()→piece.artists.append(artist))