Creating an NSPredicate Using predicateWithBlock
suggest changeObjective-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.isKindOfClass(UILabel.self)
}
In this example, the predicate will match items that are of the class UILabel
.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents