mapbox-gl-native
mapbox-gl-native copied to clipboard
Syntax error while adding a filter to pre-exisiting filter in a fill layer using NSCompoundPredicate
Hi, I have a fillLayer which already has some filter and I want to add a new filter to this FillLayer using NSCompoundPredicate but I'm facing an issue.
let filter = NSPredicate(format: "\"prop\" == %@", "val")
fillLayer.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [fillLayer.predicate, filter])
Here fillLayer is of type MGLFillStyleLayer.
The second line throws the following error:
Cannot convert value of type 'NSPredicate?' to expected element type 'Array<NSPredicate>.ArrayLiteralElement' (aka 'NSPredicate')
Any help is appreciated.