0
votes

I have an array which consist of core data class objects. I want to use NSPredicate (for suggestive search) to filter out a particular property of that class.

Requirement I am having a core data classes: AlbumDetails (properties- album name, albumType,etc) i want to access AlbumDetails.AlbumName property using NSPredicate for my search bar text. I currently know using predicate for simple array or dictionary structures, but how can i use predicate for a property of a particular class.

1
So what is the question? - Anil Varghese
@Anil please refer edited question, is it clear now. - Rahul Mathur

1 Answers

1
votes

You can use something like

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"albumName contains[cd] %@", searchString];

Where albumName is the property of your class. contains will help you to get all the albums whose name contains the searchString