Permalink
Browse files

Add method to get predicate with check for nil

  • Loading branch information...
1 parent d470149 commit 96b3682533529767b417bf836e4ac01bc080e779 @danielctull danielctull committed Apr 30, 2011
Showing with 5 additions and 0 deletions.
  1. +1 −0 NSPredicate+DCTExtras.h
  2. +4 −0 NSPredicate+DCTExtras.m
@@ -39,6 +39,7 @@
@interface NSPredicate (DCTExtras)
+ (NSPredicate *)dct_predicateWhereProperty:(NSString *)name equals:(id)object;
++ (NSPredicate *)dct_predicateWherePropertyIsNil:(NSString *)name;
+ (NSPredicate *)dct_predicateWherePropertyIsNotNil:(NSString *)name;
+ (NSPredicate *)dct_predicateWhereStringPropertyIsNotNilAndNotEmpty:(NSString *)name;
@@ -42,6 +42,10 @@ + (NSPredicate *)dct_predicateWhereProperty:(NSString *)name equals:(id)object {
return [NSPredicate predicateWithFormat:@"%K == %@", name, object];
}
++ (NSPredicate *)dct_predicateWherePropertyIsNil:(NSString *)name {
+ return [NSPredicate predicateWithFormat:@"%K == nil", name];
+}
+
+ (NSPredicate *)dct_predicateWherePropertyIsNotNil:(NSString *)name {
return [NSPredicate predicateWithFormat:@"%K != nil", name];
}

0 comments on commit 96b3682

Please sign in to comment.