I need to filter an array by a property from an object that is inside another array. Let's say that I got two classes like:
StoreList.h
@interface StoreList : NSObject {
  NSMutableArray *storesArray; //Array containing Store objects
}
Store.h
@interface Store : NSObject {
  NSString *name;
}
So, I have an NSArray (storeListArray) that have some StoreList objects in it. Then, my Array is something like this:
storeListArray = [
 StoreList:{
    storesArray: {
                  stores[{
                    store: {
                     name: "Store1"
                    },
                    store: {
                     name: "Store2"
                    }
                  }]
                },
    storesArray: {
                  stores[{
                    store: {
                     name: "Store1"
                    },
                    store: {
                     name: "Store2"
                    }
                  }]
                }
   }
];
Well, my question is: How can I filter storeListArray by the "name" property of the Store Object, using NSPredicate?
I was trying to do something like this, but this don't work:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"ANY storeList CONTAINS[cd] %@", filterString];
self.filteredStores = [storeListArray filteredArrayUsingPredicate:predicate];
return self.filteredStores;
Thanks for helping!