mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

Syntax error while adding a filter to pre-exisiting filter in a fill layer using NSCompoundPredicate

Open alankritsingh opened this issue 2 years ago • 0 comments

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.

alankritsingh avatar May 15 '23 18:05 alankritsingh