From 21aa5aadc81c058cd6b770b82f34d8c753c9003c Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 20 Apr 2018 16:04:00 -0400 Subject: [PATCH 1/4] [ios, macos] Rename featureProperties to featureAttributes. --- platform/darwin/src/NSExpression+MGLAdditions.h | 4 +++- platform/darwin/src/NSExpression+MGLAdditions.mm | 9 +++++++-- platform/darwin/test/MGLExpressionTests.mm | 10 +++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/platform/darwin/src/NSExpression+MGLAdditions.h b/platform/darwin/src/NSExpression+MGLAdditions.h index 64cbe974180..cfdf27aade4 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 df7e3e98f41..f0edd6e05b8 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -656,6 +656,10 @@ + (NSExpression *)featureIdentifierVariableExpression { return [NSExpression expressionForVariable:@"featureIdentifier"]; } ++ (NSExpression *)featureAttributesVariableExpression { + return [NSExpression expressionForVariable:@"featureAttributes"]; +} + + (NSExpression *)featurePropertiesVariableExpression { return [NSExpression expressionForVariable:@"featureProperties"]; } @@ -901,7 +905,7 @@ + (instancetype)expressionWithMGLJSONObject:(id)object { } 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,8 @@ - (id)mgl_jsonExpressionObject { if ([self.variable isEqualToString:@"featureIdentifier"]) { return @[@"id"]; } - if ([self.variable isEqualToString:@"featureProperties"]) { + if ([self.variable isEqualToString:@"featureProperties"] || + [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 d7c86ed07c4..320b98696b6 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -183,11 +183,15 @@ - (void)testVariableExpressionObject { 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); } + { + NSExpression *expression = [NSExpression expressionForVariable:@"featureProperties"]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, @[@"properties"]); + } { NSExpression *expression = [NSExpression expressionForVariable:@"loremIpsum"]; NSArray *jsonExpression = @[@"var", @"loremIpsum"]; @@ -867,7 +871,7 @@ - (void)testLookupExpressionObject { } { 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); From bb56e49491df9af54d9617e1e639612bdef53604 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 20 Apr 2018 16:06:15 -0400 Subject: [PATCH 2/4] [ios, macos] Update style documentation. --- platform/darwin/docs/guides/For Style Authors.md.ejs | 2 +- platform/darwin/docs/guides/Predicates and Expressions.md | 2 +- platform/ios/docs/guides/For Style Authors.md | 2 +- platform/macos/docs/guides/For Style Authors.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index bca894c0632..2ae6602224e 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 b45434053c4..c3b3d39a521 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/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index fa65b3ccb9b..b3beea8540c 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/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md index fff70d0a904..22182c78104 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')` From 1e4da7229c17b14cc48c135e71563d5e753679ee Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 20 Apr 2018 16:57:27 -0400 Subject: [PATCH 3/4] [ios, macos] Remove featureProperties variable tests. --- platform/darwin/src/NSExpression+MGLAdditions.mm | 5 ++--- platform/darwin/test/MGLExpressionTests.mm | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index f0edd6e05b8..c82a7dc008a 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -661,7 +661,7 @@ + (NSExpression *)featureAttributesVariableExpression { } + (NSExpression *)featurePropertiesVariableExpression { - return [NSExpression expressionForVariable:@"featureProperties"]; + return [self featureAttributesVariableExpression]; } + (instancetype)mgl_expressionForConditional:(nonnull NSPredicate *)conditionPredicate trueExpression:(nonnull NSExpression *)trueExpression falseExpresssion:(nonnull NSExpression *)falseExpression { @@ -1004,8 +1004,7 @@ - (id)mgl_jsonExpressionObject { if ([self.variable isEqualToString:@"featureIdentifier"]) { return @[@"id"]; } - if ([self.variable isEqualToString:@"featureProperties"] || - [self.variable isEqualToString:@"featureAttributes"]) { + 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 320b98696b6..d54e961b005 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -188,10 +188,6 @@ - (void)testVariableExpressionObject { XCTAssertEqualObjects([NSExpression expressionWithFormat:@"$featureAttributes"].mgl_jsonExpressionObject, @[@"properties"]); XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:@[@"properties"]], expression); } - { - NSExpression *expression = [NSExpression expressionForVariable:@"featureProperties"]; - XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, @[@"properties"]); - } { NSExpression *expression = [NSExpression expressionForVariable:@"loremIpsum"]; NSArray *jsonExpression = @[@"var", @"loremIpsum"]; From 72ad36eaca31cd47b8c129363e4df168d13f17e6 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Date: Fri, 20 Apr 2018 17:02:10 -0400 Subject: [PATCH 4/4] [ios, macos] Update the changelogs. --- platform/ios/CHANGELOG.md | 6 ++++++ platform/macos/CHANGELOG.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index c7e9b053c4d..4c69d94ec48 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/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 37a6ed39cce..498ed3c379b 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.