This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Represent $type as member selector expression in predicates #7298
Labels
archived
Archived because of inactivity
bug
iOS
Mapbox Maps SDK for iOS
macOS
Mapbox Maps SDK for macOS
runtime styling
MGLVectorStyleLayer.predicate
should recognize expressions invoking theisKindOfClass:
selector onself
and convert them to comparisons involving$type
. TheMGLVectorStyleLayer.predicate
documentation currently defines the special$type
attribute as the following:These four special strings are discoverable only via documentation, and
$type
can’t occur inside a predicate format string because$
denotes a predicate variable. Adding a string enumeration for these strings could help with discoverability, but I think a more self-consistent approach would be to useisKindOfClass:
in conjunction with the classes we’ve already mapped to the vector feature types, since this is how you filter types when filtering NSArrays. What we currently represent as:turns into:
Under the hood,
self
is parsed as+[NSExpression expressionForEvaluatedObject]
and has an expression type ofNSEvaluatedObjectExpressionType
. TheisKindOfClass:
expression is initialized with-[NSComparisonPredicate initWithLeftExpression:rightExpression:customSelector:]
, andcustomSelector
containsisKindOfClass:
./ref #6970
/cc @frederoni @incanus @boundsj
The text was updated successfully, but these errors were encountered: