Creating an NSPredicate Using predicateWithBlock

suggest change

Objective-C

NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id item, NSDictionary *bindings) {
    return [item isKindOfClass:[UILabel class]];
}];

Swift

let predicate = NSPredicate { (item, bindings) -> Bool in
    return item is UILabel
}

In this example, the predicate will match items that are of the class UILabel.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents