NSPredicate with functions or selectors

后端 未结 3 1090
抹茶落季
抹茶落季 2020-12-19 08:37

I have a lot of people NSManagedObjects that I need filtering and was hoping to do it within the initial fetch instead of filtering the array afterwards. I\'ve used selector

3条回答
  •  -上瘾入骨i
    2020-12-19 09:01

    This gets a whole lot easier with Blocks:

    NSPredicate *bossPred = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
    
        return [evaluatedObject isKindOfClass:[Boss class]];
    }];
    

提交回复
热议问题