From a45670cfb5752866b9c8130024a313944684c2db Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Mon, 23 Apr 2018 09:05:36 -0400 Subject: [ios, macos] Rename featureProperties to featureAttributes. (#11748) * [ios, macos] Rename featureProperties to featureAttributes. * [ios, macos] Update style documentation. * [ios, macos] Remove featureProperties variable tests. * [ios, macos] Update the changelogs. --- platform/darwin/docs/guides/For Style Authors.md.ejs | 2 +- platform/darwin/docs/guides/Predicates and Expressions.md | 2 +- platform/darwin/src/NSExpression+MGLAdditions.h | 4 +++- platform/darwin/src/NSExpression+MGLAdditions.mm | 10 +++++++--- platform/darwin/test/MGLExpressionTests.mm | 6 +++--- platform/ios/CHANGELOG.md | 6 ++++++ platform/ios/docs/guides/For Style Authors.md | 2 +- platform/macos/CHANGELOG.md | 6 ++++++ platform/macos/docs/guides/For Style Authors.md | 2 +- 9 files changed, 29 insertions(+), 11 deletions(-) diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index bca894c063..2ae6602224 100644 --- a/platform/darwin/docs/guides/For Style Authors.md.ejs +++ b/platform/darwin/docs/guides/For Style Authors.md.ejs @@ -341,7 +341,7 @@ In style specification | Method, function, or predicate type | Format string syn `typeof` | | `geometry-type` | `NSExpression.geometryTypeVariableExpression` | `$geometryType` `id` | `NSExpression.featureIdentifierVariableExpression` | `$featureIdentifier` -`properties` | `NSExpression.featurePropertiesVariableExpression` | `$featureProperties` +`properties` | `NSExpression.featureAttributesVariableExpression` | `$featureAttributes` `at` | `objectFrom:withIndex:` | `array[n]` `get` | `+[NSExpression expressionForKeyPath:]` | Key path `has` | `mgl_does:have:` | `mgl_does:have:(self, 'key')` diff --git a/platform/darwin/docs/guides/Predicates and Expressions.md b/platform/darwin/docs/guides/Predicates and Expressions.md index b45434053c..c3b3d39a52 100644 --- a/platform/darwin/docs/guides/Predicates and Expressions.md +++ b/platform/darwin/docs/guides/Predicates and Expressions.md @@ -630,7 +630,7 @@ otherwise TRUE.
Selector:
mgl_has:
Format string syntax:
-
FUNCTION($featureProperties, 'mgl_has:', '🧀🍔')
+
FUNCTION($featureAttributes, 'mgl_has:', '🧀🍔')
Target:
An NSExpression that evaluates to an NSDictionary diff --git a/platform/darwin/src/NSExpression+MGLAdditions.h b/platform/darwin/src/NSExpression+MGLAdditions.h index 64cbe97418..cfdf27aade 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.h +++ b/platform/darwin/src/NSExpression+MGLAdditions.h @@ -80,7 +80,9 @@ extern MGL_EXPORT const MGLExpressionInterpolationMode MGLExpressionInterpolatio properties expression operator in the Mapbox Style Specification. */ -@property (class, nonatomic, readonly) NSExpression *featurePropertiesVariableExpression; +@property (class, nonatomic, readonly) NSExpression *featureAttributesVariableExpression; + +@property (class, nonatomic, readonly) NSExpression *featurePropertiesVariableExpression __attribute__((deprecated("Use -featureAttributesVariableExpression."))); #pragma mark Creating Conditional Expressions diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index df7e3e98f4..c82a7dc008 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -656,8 +656,12 @@ NS_DICTIONARY_OF(NSNumber *, NSExpression *) *MGLStopDictionaryByReplacingTokens return [NSExpression expressionForVariable:@"featureIdentifier"]; } ++ (NSExpression *)featureAttributesVariableExpression { + return [NSExpression expressionForVariable:@"featureAttributes"]; +} + + (NSExpression *)featurePropertiesVariableExpression { - return [NSExpression expressionForVariable:@"featureProperties"]; + return [self featureAttributesVariableExpression]; } + (instancetype)mgl_expressionForConditional:(nonnull NSPredicate *)conditionPredicate trueExpression:(nonnull NSExpression *)trueExpression falseExpresssion:(nonnull NSExpression *)falseExpression { @@ -901,7 +905,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { } else if ([op isEqualToString:@"id"]) { return NSExpression.featureIdentifierVariableExpression; } else if ([op isEqualToString:@"properties"]) { - return NSExpression.featurePropertiesVariableExpression; + return NSExpression.featureAttributesVariableExpression; } else if ([op isEqualToString:@"var"]) { return [NSExpression expressionForVariable:argumentObjects.firstObject]; } else if ([op isEqualToString:@"case"]) { @@ -1000,7 +1004,7 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { if ([self.variable isEqualToString:@"featureIdentifier"]) { return @[@"id"]; } - if ([self.variable isEqualToString:@"featureProperties"]) { + if ([self.variable isEqualToString:@"featureAttributes"]) { return @[@"properties"]; } return @[@"var", self.variable]; diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index d7c86ed07c..d54e961b00 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -183,9 +183,9 @@ using namespace std::string_literals; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:@[@"id"]], expression); } { - NSExpression *expression = [NSExpression expressionForVariable:@"featureProperties"]; + NSExpression *expression = [NSExpression expressionForVariable:@"featureAttributes"]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, @[@"properties"]); - XCTAssertEqualObjects([NSExpression expressionWithFormat:@"$featureProperties"].mgl_jsonExpressionObject, @[@"properties"]); + XCTAssertEqualObjects([NSExpression expressionWithFormat:@"$featureAttributes"].mgl_jsonExpressionObject, @[@"properties"]); XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:@[@"properties"]], expression); } { @@ -867,7 +867,7 @@ using namespace std::string_literals; } { NSExpression *expression = [NSExpression expressionForFunction:@"mgl_does:have:" - arguments:@[[NSExpression expressionForVariable:@"featureProperties"], + arguments:@[[NSExpression expressionForVariable:@"featureAttributes"], [NSExpression expressionForConstantValue:@"x"]]]; NSArray *jsonExpression = @[@"has", @"x", @[@"properties"]]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index c7e9b053c4..4c69d94ec4 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,6 +2,12 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. +## 4.0.1 + +### Style layers + +* Deprecated `+[NSExpression featurePropertiesVariableExpression]` use `+[NSExpression featureAttributesVariableExpression]` instead. ([#11748](https://github.com/mapbox/mapbox-gl-native/pull/11748)) + ## 4.0.0 - April 19, 2018 The 4.0._x_ series of releases will be the last to support iOS 8. The minimum iOS deployment version will increase to iOS 9.0 in a future release. diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index fa65b3ccb9..b3beea8540 100644 --- a/platform/ios/docs/guides/For Style Authors.md +++ b/platform/ios/docs/guides/For Style Authors.md @@ -331,7 +331,7 @@ In style specification | Method, function, or predicate type | Format string syn `typeof` | | `geometry-type` | `NSExpression.geometryTypeVariableExpression` | `$geometryType` `id` | `NSExpression.featureIdentifierVariableExpression` | `$featureIdentifier` -`properties` | `NSExpression.featurePropertiesVariableExpression` | `$featureProperties` +`properties` | `NSExpression.featureAttributesVariableExpression` | `$featureAttributes` `at` | `objectFrom:withIndex:` | `array[n]` `get` | `+[NSExpression expressionForKeyPath:]` | Key path `has` | `mgl_does:have:` | `mgl_does:have:(self, 'key')` diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 37a6ed39cc..498ed3c379 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog for Mapbox Maps SDK for macOS +## 0.7.1 + +### Style layers + +* Deprecated `+[NSExpression featurePropertiesVariableExpression]` use `+[NSExpression featureAttributesVariableExpression]` instead. ([#11748](https://github.com/mapbox/mapbox-gl-native/pull/11748)) + ## 0.7.0 - April 19, 2018 The 0.7._x_ series of releases will be the last to support macOS 10.10. The minimum macOS deployment version will increase to macOS 10.11.0 in a future release. diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md index fff70d0a90..22182c7810 100644 --- a/platform/macos/docs/guides/For Style Authors.md +++ b/platform/macos/docs/guides/For Style Authors.md @@ -324,7 +324,7 @@ In style specification | Method, function, or predicate type | Format string syn `typeof` | | `geometry-type` | `NSExpression.geometryTypeVariableExpression` | `$geometryType` `id` | `NSExpression.featureIdentifierVariableExpression` | `$featureIdentifier` -`properties` | `NSExpression.featurePropertiesVariableExpression` | `$featureProperties` +`properties` | `NSExpression.featureAttributesVariableExpression` | `$featureAttributes` `at` | `objectFrom:withIndex:` | `array[n]` `get` | `+[NSExpression expressionForKeyPath:]` | Key path `has` | `mgl_does:have:` | `mgl_does:have:(self, 'key')` -- cgit v1.2.1