The book gives these examples for [size] predicates... // Determines if the target has at least 3 children. [NSPredicate predicateWithFormat:@"children[size] < 3"]; ... // Determines if the target has at least 3 adult children. [NSPredicate predicateWithFormat:@"(children[size] < 3) AND (NONE children.age < %@)", [NSNumber numberWithInt:18]];
I didn't test these, but wouldn't the first return targets with less than 3 children, and the second with less than 3 children aged 18 or older? So the code examples should be... // Determines if the target has at least 3 children. [NSPredicate predicateWithFormat:@"children[size] > 2"]; ... // Determines if the target has at least 3 adult children. [NSPredicate predicateWithFormat:@"(children[size] > 2) AND (NONE children.age < %@)", [NSNumber numberWithInt:18]];
The book gives these examples for [size] predicates...
// Determines if the target has at least 3 children.
[NSPredicate predicateWithFormat:@"children[size] < 3"];
...
// Determines if the target has at least 3 adult children.
[NSPredicate predicateWithFormat:@"(children[size] < 3) AND (NONE children.age < %@)", [NSNumber numberWithInt:18]];
I didn't test these, but wouldn't the first return targets with less than 3 children, and the second with less than 3 children aged 18 or older? So the code examples should be...
// Determines if the target has at least 3 children.
[NSPredicate predicateWithFormat:@"children[size] > 2"];
...
// Determines if the target has at least 3 adult children.
[NSPredicate predicateWithFormat:@"(children[size] > 2) AND (NONE children.age < %@)", [NSNumber numberWithInt:18]];