How can i filter an array of custom objects by one ore more flags ?
let flags = ["New product", "Season 2014", "Season 2015", "Product available"]
With one flag or more static flags is easy:
let filteredArray = myCustomObjectsArray.filter() { $0.isNew == true }
let filteredArray = myCustomObjectsArray.filter() { $0.isNew == true && $0.season.rangeOfString("14") && $0.season.rangeOfString("15") && $0.isAvailable }
But what if flags are dynamic i.e. flags array is created by user tapping on cells of the tableview ?
Other problem is an error when trying to concatenate multiple conditions in `filter() { condition1 && condition2 etc.}. " Expression was to complex to be solved in reasonable time ...".
So, flags array is what user selected (just titles from a tableview cells). If flags array is ["New product", "Season 2015"], i want to filter by .isNew and .season.rangeOfString("15") for example. So i'm sorting by properties and NOT by string.