I have an
Array
Item 0 -- Dictionary
Sport -- String
Mens -- Array
Item 0 -- Dictionary
Name -- String
Rules -- String
Description -- String
Womens -- Array
Item 0 -- Dictionary
Name -- String
Rules -- String
Description -- String
Item 1 -- Dictionary
And so on.....
I would like to create a NSPredicate searching if a given string is contained inside of Name. How can I achieve reaching that deep?
If you cant understand the graph. I have an array full of dictionaries, Inside the dictionaries are A string, An Array of dictionaries, and An Array of dictionaries, Inside of the dictionaries are string objects
So How do I get into the second dictionaries and search the Name key
Thanks in advance
You need the following
NSString *str = <search string>;
NSPredicate *pred = [NSPredicate predicateWithFormat:@"ANY Mens.Name LIKE %@ OR ANY Womens.Name LIKE %@", str, str];
NSArray *result = [your_array filteredArrayUsingPredicate:pred];
BOOL success = result.count > 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With