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

Streamline custom function syntax for NSExpression #11015

Closed
1ec5 opened this issue Jan 24, 2018 · 1 comment
Closed

Streamline custom function syntax for NSExpression #11015

1ec5 opened this issue Jan 24, 2018 · 1 comment
Assignees
Labels
feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS release blocker Blocks the next final release runtime styling

Comments

@1ec5
Copy link
Contributor

1ec5 commented Jan 24, 2018

As of the initial NSExpression implementation in #10726, we rely on the clunky custom function syntax to represent many of the style specification’s expression operators. For example, string concatenation is a common operation by requires all sorts of undiscoverable and error-prone punctuation:

NSExpression(format: "FUNCTION('Old', 'stringByAppendingString:', FUNCTION(' ', 'stringByAppendingString:', 'MacDonald'))")

As previously proposed in #8074 (comment), we should extend the private _NSPredicateUtilities class using the Objective-C runtime:

NSExpression(format: "mgl_join({'Old', ' ', 'MacDonald'})")

This would result in the most natural usage, but it’s also a bit Clever™. We’ll need to tiptoe around a bit to avoid directly using any private APIs, and we’ll need to include safeguards in case the underlying NSExpression implementation changes at any point.

/cc @akitchen @fabian-guerra @jmkiley

@1ec5 1ec5 added feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS release blocker Blocks the next final release runtime styling labels Jan 24, 2018
@1ec5 1ec5 added this to the ios-v4.0.0 milestone Jan 24, 2018
@1ec5 1ec5 self-assigned this Feb 6, 2018
@fabian-guerra
Copy link
Contributor

Fixed in #11472

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS release blocker Blocks the next final release runtime styling
Projects
None yet
Development

No branches or pull requests

2 participants