mapbox-gl-native
mapbox-gl-native copied to clipboard
iconTextFit / iconTextFitPadding NSExpression forConstantValue not working (Crash)
Steps to reproduce
- Take MGLSymbolStyleLayer with property iconTextFit or iconTextFitPadding.
- Then assign NSExpression like this:
symbolStyleLayer.iconTextFit = NSExpression(
forConditional: NSPredicate(format: "%K == "isTextSmall"),
trueExpression: NSExpression(forConstantValue: "both"),
falseExpression: NSExpression(forConstantValue: "width")
)
symbolStyleLayer.text = .init(format: "%K", "myTitle")
- Creating MGLPointFeature with attribute:
let feature = MGLPointFeature()
feature.attributes = ["isTextSmall": true, "myTitle": " where my spaces? "]
then update layer with source
let shape = MGLShapeCollectionFeature(shapes: features)
(style.source(withIdentifier: source.rawValue) as? MGLShapeSource)?.shape = shape
Expected behavior
Works as well as for iconOpacity attribute for instance. The property depends on income value.
Actual behavior
App crashes with this error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid property value: data expressions not supported' terminating with uncaught exception of type NSException
PS. Why does MGLSymbolStyleLayer 'text' property trims spaces/tabs before it and at the end ? How can I add some extra spaces ?
Thanks for responses and advice.
Configuration
**Mapbox SDK versions: Mapbox-iOS-SDK (6.3.0) **iOS/macOS versions: iOS 14.4 **Device/simulator models: iphone X **Xcode version: 12.4 (12D4e)