Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

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

Open
alankritsingh opened this issue May 15, 2023 · 0 comments

Comments

@alankritsingh
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant