There appears to be zero documentation about the SUBQUERY keyword from Apple and I can\'t find a simple explanation about it on SO or on Google. It\'s a conspiracy! ;)
Subquery represents a predicate (third argument - $x IN %@
) that is evaluated on all objects (second argument - $x
- it's like a variable name in foreach) of a relationship (first argument - Bs
). Similarly to regular query returns a list of objects.
I see in many places that people use $x
almost dogmatically, but $object
in objects
relationship makes perfect sense as well (or $city
in cities
...) :)
I've written a blog post about SUBQUERY
some time ago. You can check it here.