mapbox / mapbox-annotation-extension

Framework extensions that can be used with the Mapbox Maps SDK for iOS.
ISC License
11 stars 18 forks source link

Runtime styling #60

Open ritter1 opened 4 years ago

ritter1 commented 4 years ago

Is there already a way to dynamically style a symbol?

How would I dynamically show/hide an icon? Formerly, with expression, it worked like this: symbols.iconOpacity = NSExpression(format: "mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", [5.9: 0, 6: 1])

maximumbuster commented 4 years ago

I don't think this is supported on ios currently although it's supported on the android mapbox annotation plugin by setting a filter expression on the style layer: android docs.

A similar style layer object is available in the ios annotation controllers as well though so perhaps this could be added as a feature request?

captainbarbosa commented 4 years ago

Hi @ritter1 - @maximumbuster is correct, this extension currently doesn't support NSExpression usage for runtime styling. I will keep this issue open though for future tracking purposes.

maximumbuster commented 4 years ago

@captainbarbosa It appears that the mapbox layers already have support for setting a predicate to do filtering, do you know if we could just add a set predicate method on the annotation controllers which would pass the predicate along to the controller's style layer? https://docs.mapbox.com/ios/api/maps/4.2.0/Classes/MGLVectorStyleLayer.html#/c:objc(cs)MGLVectorStyleLayer(py)predicate