summaryrefslogtreecommitdiff
path: root/platform/darwin/src/NSExpression+MGLAdditions.h
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/NSExpression+MGLAdditions.h')
-rw-r--r--platform/darwin/src/NSExpression+MGLAdditions.h43
1 files changed, 36 insertions, 7 deletions
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.h b/platform/darwin/src/NSExpression+MGLAdditions.h
index 491ed5a536..b4d36bc1b1 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.h
+++ b/platform/darwin/src/NSExpression+MGLAdditions.h
@@ -1,17 +1,46 @@
#import <Foundation/Foundation.h>
+#if TARGET_OS_IPHONE
+ #import <UIKit/UIKit.h>
+#else
+ #import <Cocoa/Cocoa.h>
+#endif
-#include <mbgl/style/filter.hpp>
+#import "MGLTypes.h"
NS_ASSUME_NONNULL_BEGIN
@interface NSExpression (MGLAdditions)
-@property (nonatomic, readonly) mbgl::Value mgl_constantMBGLValue;
-@property (nonatomic, readonly) std::vector<mbgl::Value> mgl_aggregateMBGLValue;
-@property (nonatomic, readonly) mbgl::FeatureType mgl_featureType;
-@property (nonatomic, readonly) std::vector<mbgl::FeatureType> mgl_aggregateFeatureType;
-@property (nonatomic, readonly) mbgl::FeatureIdentifier mgl_featureIdentifier;
-@property (nonatomic, readonly) std::vector<mbgl::FeatureIdentifier> mgl_aggregateFeatureIdentifier;
+/**
+ Returns an expression equivalent to the given Foundation object deserialized
+ from JSON data.
+
+ The Foundation object is interpreted according to the
+ [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions).
+ See the “[Predicates and Expressions](../predicates-and-expressions.html)”
+ guide for a correspondence of operators and types between the style
+ specification and the `NSExpression` representation used by this SDK.
+
+ @param object A Foundation object deserialized from JSON data, for example
+ using `NSJSONSerialization`.
+ @return An initialized expression equivalent to `object`, suitable for use as
+ the value of a style layer attribute.
+ */
++ (instancetype)mgl_expressionWithJSONObject:(id)object;
+
+/**
+ An equivalent Foundation object that can be serialized as JSON.
+
+ The Foundation object conforms to the
+ [Mapbox Style Specification](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions).
+ See the “[Predicates and Expressions](../predicates-and-expressions.html)”
+ guide for a correspondence of operators and types between the style
+ specification and the `NSExpression` representation used by this SDK.
+
+ You can use `NSJSONSerialization` to serialize the Foundation object as data to
+ write to a file.
+ */
+@property (nonatomic, readonly) id mgl_jsonExpressionObject;
@end