title: Filtering objects from array by a property, using the method filteredArrayUsingPredicate
body: <p>I can't understand how to use predicate, I have a very long code to filter objects from array by property "type" and suddenly I saw method "filteredArrayUsingPredicate" that can make my life better. I try write predicates but I always get errors; can someone show me how to write it right?</p>
  
  <p>I have method <code>- (void) filterData: (NSString *)filteredWord</code>:</p>
  
  <p>I also have array with objects (Event): <strong>NSArray *eventsArray</strong>. 
  I want use a filteredArrayUsingPredicate to get new array with objects (Event) where their property (type) is equal filterWord. Note that Event is Core Data Managed subclass.</p>
  
  <p>Is it even possible to do this with predicate? </p>
  
  <p>One of my attempts:</p>
  
  <pre><code>NSString *propertyName = @"type";
  NSArray *eventsArray = [[[[self currentPerson] events] objectEnumerator]allObjects];
  NSPredicate *predicte = [NSPredicate predicateWithFormat:@"%k like '%@'",propertyName,filteredWord];
  [eventsArray filteredArrayUsingPredicate:predicte];
  </code></pre>