This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Install aftermarket expression functions #11472
Merged
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
09810d5
[ios, macos] Introduced more ergonomic expression concatenation syntax
1ec5 f10402d
[ios, macos] Fixed mgl_join:
1ec5 5ce7411
[ios, macos] Simplified expression document headings
1ec5 3f02c5e
[ios, macos] Documented mgl_join:
1ec5 38c31dd
[ios, macos] Convert length operator to length: for strings
1ec5 66648e5
[ios, macos] Implemented type conversion using CAST()
1ec5 1dcc93d
[ios, macos] Aftermarket let expressions
1ec5 e467df8
[ios, macos] Refactored aftermarket expression functions
1ec5 ee3b5a2
[ios, macos] Updated documentation, tests, demo apps
1ec5 3b79fc9
[ios, macos] Added generic expression function
1ec5 d84eede
[ios, macos] Add MGL_MATCH function placeholder.
fabian-guerra ddc7769
[ios, macos] Add MGL_SWITCH expression operator.
fabian-guerra 63d7ebb
[ios, macos] Add mgl_coalesce: as expression function.
fabian-guerra c06655e
[ios, macos] Update style documentation.
fabian-guerra 74b425f
[ios, macos] Add conventional custom function support.
fabian-guerra 8d19aaa
[ios, macos] Updated example code
1ec5 79844eb
[ios, macos] Add mgl_coalesce conventional custom function support.
fabian-guerra 0a9b7a0
[ios, macos] Add aftermarket function to 'has' operator.
fabian-guerra a51ae90
[ios, macos] Add documentation for lookup and feature operators.
fabian-guerra 2625c7c
[ios, macos] Documented simple lookup
1ec5 72499da
[ios, macos] Renamed, reversed has expression
1ec5 9c70d38
[ios, macos] Restored OEM conditionals where available
1ec5 5bb9ca2
[ios, macos] Update style docs.
fabian-guerra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,8 +192,9 @@ string syntax: | |
|
||
Initializer parameter | Format string syntax | Description | ||
----------------------|----------------------|------------ | ||
`mgl_does:have:` | `mgl_does:have:(SELF, 'key')` or `mgl_does:have:(%@, 'key')` | Returns a Boolean value indicating whether the dictionary has a value for the key or whether the evaluated object (`SELF`) has a value for the feature attribute. Compared to the `mgl_has:` custom function, that function’s target is instead passed in as the first argument to this function. Both functions are equivalent to the syntax `key != NIL` or `%@[key] != NIL` but can be used outside of a predicate. | ||
`mgl_interpolate:withCurveType:parameters:stops:` | `mgl_interpolate:withCurveType:parameters:stops:(x, 'linear', nil, %@)` | Produces continuous, smooth results by interpolating between pairs of input and output values (“stops”). Compared to the `mgl_interpolateWithCurveType:parameters:stops:` custom function, the input expression (that function’s target) is instead passed in as the first argument to this function. | ||
`mgl_step:from:stops:` | `mgl_step:from:stops:(x, 11, %@)` |Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of input and output values ("stops"). Compared to the `mgl_stepWithMinimum:stops:` custom function, the input expression (that function’s target) is instead passed in as the first argument to this function. | ||
`mgl_step:from:stops:` | `mgl_step:from:stops:(x, 11, %@)` | Produces discrete, stepped results by evaluating a piecewise-constant function defined by pairs of input and output values ("stops"). Compared to the `mgl_stepWithMinimum:stops:` custom function, the input expression (that function’s target) is instead passed in as the first argument to this function. | ||
`mgl_join:` | `mgl_join({'Old', 'MacDonald'})` | Returns the result of concatenating together all the elements of an array in order. Compared to the `stringByAppendingString:` custom function, this function takes only one argument, which is an aggregate expression containing the strings to concatenate. | ||
`mgl_coalesce:` | `mgl_coalesce({x, y, z})` | Returns the first non-`nil` value from an array of expressions. | ||
`MGL_LET` | `MGL_LET('age', uppercase('old'), 'name', uppercase('MacDonald'), mgl_join({$age, $name}))` | Any number of variable names interspersed with their assigned `NSExpression` values, followed by an `NSExpression` that may contain references to those variables. Compared to the `mgl_expressionWithContext:` custom function, this function takes the variable names and values inline before the expression that contains references to those variables. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rows need to be added for |
||
|
@@ -221,6 +222,17 @@ The following custom functions are also available with the | |
empty string, 0, `FALSE`, `NIL`, or NaN, otherwise `TRUE`. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td><code>mgl_has:</code></td> | ||
<td> | ||
An `NSExpression` that evaluates to an <code>NSDictionary</code> or the evaluated object (<code>SELF</code>). | ||
</td> | ||
<td> | ||
An `NSExpression` that evaluates to an <code>NSString</code> representing the key to look up in the dictionary or the feature attribute to look up in the evaluated object (see <code>MGLFeature.attributes</code>). | ||
</td> | ||
<td> | ||
`true` if the dictionary has a value for the key or if the evaluated object has a value for the feature attribute. | ||
</td> | ||
<tr> | ||
<td><code>mgl_expressionWithContext:</code></td> | ||
<td> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed and reordered this function. Instead of calling
mgl_hasProperty:properties:('key', self)
, you callmgl_does:have:(self, 'key')
. I think this reads better: “Does self have ‘key’?” It’s also consistent with the order when you call the conventional function:FUNCTION(self, 'mgl_has:', 'key')
.