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

Add NSExpression syntax for conditionals with multiple branches #11007

Closed
1ec5 opened this issue Jan 24, 2018 · 3 comments
Closed

Add NSExpression syntax for conditionals with multiple branches #11007

1ec5 opened this issue Jan 24, 2018 · 3 comments
Assignees
Labels
GL JS parity For feature parity with Mapbox GL JS 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

The NSExpression-based property value implementation in #10726 should support a more compact syntax for conditionals with multiple branches. Currently, an NSExpression containing a nested TERNARY gets converted into nested case expressions, and a case expression with multiple branches gets converted into a nested TERNARY structure. At least a nested TERNARY should be converted into a flat case.

@1ec5 1ec5 added GL JS parity For feature parity with Mapbox GL JS iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Jan 24, 2018
@1ec5 1ec5 added this to the ios-v4.0.0 milestone Jan 24, 2018
@1ec5
Copy link
Contributor Author

1ec5 commented Feb 13, 2018

@friedbunny pointed out that +[NSExpression expressionForConditional:trueExpression:falseExpression:] is unavailable in iOS 8.x, so the proposed syntax would be even more useful for developers that need to deploy back to that version.

@friedbunny
Copy link
Contributor

Indeed, besides recommending +[NSExpression expressionForConditional:trueExpression:falseExpression:] in the docs a couple times, we use it here:

return [NSExpression expressionForConditional:conditional trueExpression:trueExpression falseExpression:falseExpression];

and here:

NSExpression *expression = [NSExpression expressionForConditional:conditional trueExpression:trueExpression falseExpression:falseExpression];

@1ec5
Copy link
Contributor Author

1ec5 commented Apr 12, 2018

Fixed in #11450 on the release-boba branch for iOS map SDK v4.0.0 and macOS map SDK v0.7.0.

@1ec5 1ec5 closed this as completed Apr 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
GL JS parity For feature parity with Mapbox GL JS 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

4 participants