* [ios, macos] Introduced more ergonomic expression concatenation syntax * [ios, macos] Fixed mgl_join: * [ios, macos] Simplified expression document headings * [ios, macos] Documented mgl_join: * [ios, macos] Convert length operator to length: for strings Only works for literal strings. * [ios, macos] Implemented type conversion using CAST() * [ios, macos] Aftermarket let expressions * [ios, macos] Refactored aftermarket expression functions Refactored the installation of aftermarket expression functions to use macros. It is no longer necessary to handwrite the type encoding of a function. Also added aftermarket functions for interpolating and stepping. * [ios, macos] Updated documentation, tests, demo apps * [ios, macos] Added generic expression function * [ios, macos] Add MGL_MATCH function placeholder. * [ios, macos] Add MGL_SWITCH expression operator. * [ios, macos] Add mgl_coalesce: as expression function. * [ios, macos] Update style documentation. * [ios, macos] Add conventional custom function support. * [ios, macos] Updated example code * [ios, macos] Add mgl_coalesce conventional custom function support. * [ios, macos] Add aftermarket function to 'has' operator. * [ios, macos] Add documentation for lookup and feature operators. * [ios, macos] Documented simple lookup * [ios, macos] Renamed, reversed has expression Renamed mgl_hasProperty:properties: to mgl_does:have: for better readability and consistency with the conventional mgl_has: function. Documented both forms of mgl_has:. * [ios, macos] Restored OEM conditionals where available This is the preferred syntax for simple conditionals on iOS 9 and above, because you can inline the predicate instead of wrapping it in a constant value expression, which means you can write a conditional in a single format string. * [ios, macos] Update style docs. Co-authored-by: Fabian Guerra <fabian.guerra@mapbox.com>
84 lines
2.1 KiB
Objective-C
84 lines
2.1 KiB
Objective-C
#import <Foundation/Foundation.h>
|
|
#if TARGET_OS_IPHONE
|
|
#import <UIKit/UIKit.h>
|
|
#else
|
|
#import <Cocoa/Cocoa.h>
|
|
#endif
|
|
|
|
#import "NSExpression+MGLAdditions.h"
|
|
|
|
#include <mbgl/style/filter.hpp>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface NSObject (MGLExpressionAdditions)
|
|
|
|
- (NSNumber *)mgl_number;
|
|
- (NSNumber *)mgl_numberWithFallbackValues:(id)fallbackValue, ... NS_REQUIRES_NIL_TERMINATION;
|
|
|
|
@end
|
|
|
|
@interface NSExpression (MGLPrivateAdditions)
|
|
|
|
@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;
|
|
|
|
@end
|
|
|
|
@interface NSNull (MGLExpressionAdditions)
|
|
|
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
|
|
|
@end
|
|
|
|
@interface NSString (MGLExpressionAdditions)
|
|
|
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
|
|
|
@end
|
|
|
|
@interface NSNumber (MGLExpressionAdditions)
|
|
|
|
- (id)mgl_interpolateWithCurveType:(NSString *)curveType parameters:(NSArray *)parameters stops:(NSDictionary<NSNumber *, id> *)stops;
|
|
- (id)mgl_stepWithMinimum:(id)minimum stops:(NSDictionary<NSNumber *, id> *)stops;
|
|
|
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
|
|
|
@end
|
|
|
|
@interface NSArray (MGLExpressionAdditions)
|
|
|
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
|
|
|
@end
|
|
|
|
@interface NSDictionary (MGLExpressionAdditions)
|
|
|
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
|
|
|
- (id)mgl_has:(id)element;
|
|
|
|
@end
|
|
|
|
@interface MGLColor (MGLExpressionAdditions)
|
|
|
|
@property (nonatomic, readonly) id mgl_jsonExpressionObject;
|
|
|
|
@end
|
|
|
|
@interface NSExpression (MGLExpressionAdditions)
|
|
|
|
- (NSExpression *)mgl_expressionWithContext:(NSDictionary<NSString *, NSExpression *> *)context;
|
|
|
|
- (id)mgl_has:(id)element;
|
|
|
|
@end
|
|
|
|
extern NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects);
|
|
|
|
NS_ASSUME_NONNULL_END
|