#Predicate and computed properties

I added a Home concept to my simple test program, which made the chain be Home has Rooms which have Items. But when I tried using something like

let homeID = self.room.home?.id ?? UUID()
_items = Query(#Predicate {
    ($0.room?.home?.id == homeID) == true
})

it complained about an illegal ternary. Fine, it's picky so I changed the Item model to have a computed property:

var home: Home? {
    return self.room?.home?.id
}

but with that, it crashes at runtime, because it can't find the keypath to .home.

Is this all expected?

spent the weekend playing with something similar ... and i think that two things that don't work with #predicates are (1) you can't use computed properties (makes sense if you think about it, since these are not key paths referencing properties of a model as stored on disk) and (2) you can't query using relationships (this is something i expect will get fixed). //DMG

I can do relationships -- but only one level. In my example above, $0.room?.id works, but $0.room?.home?.id does not.

#Predicate and computed properties
 
 
Q