I have several objects configured in Core Data, one of which is โDeckโ and one of which is โCardโ. Cards have several numbered relationships, including id. Deck has a one-to-many relationship with cards.
What is the best way to find a card on deck that has a minimum value for some numbered attribute like id?
It is clear that I can get a list of such cards:
NSSet *cardList = self.cards;
I think I can build an expression to get the minimum:
NSExpression *keyPathExpression = [NSExpression expressionForKeyPath:@"id"];
NSExpression *minExpression = [NSExpression expressionForFunction:@"min:"
arguments:[NSArray arrayWithObject:keyPathExpression]];
But I canโt understand how to use this expression to retrieve a map with a minimum id value (or just a minimum id value).