Files
MapLibreParticleLab/platform/darwin/src/NSValue+MGLAdditions.m
Minh Nguyễn 9c9ff2d2d4 [ios, osx] Updated build system for jazzy
Consolidated NSValue categories to work around realm/jazzy#539. Documented MGLErrorCode. Moved jazzy configuration file into platform/ios/. Removed redundant include/Mapbox.h that was only being used by jazzy, now that the static frameworks’s umbrella header is based on that of the dynamic framework. Moved framework/Mapbox.h to include/Mapbox.h for consistency.
2016-04-22 12:31:42 -07:00

50 lines
1.3 KiB
Objective-C

#import "NSValue+MGLAdditions.h"
@implementation NSValue (MGLAdditions)
#pragma mark Geometry
+ (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate {
return [self valueWithBytes:&coordinate objCType:@encode(CLLocationCoordinate2D)];
}
- (CLLocationCoordinate2D)MGLCoordinateValue {
CLLocationCoordinate2D coordinate;
[self getValue:&coordinate];
return coordinate;
}
+ (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span {
return [self valueWithBytes:&span objCType:@encode(MGLCoordinateSpan)];
}
- (MGLCoordinateSpan)MGLCoordinateSpanValue {
MGLCoordinateSpan span;
[self getValue:&span];
return span;
}
+ (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds {
return [self valueWithBytes:&bounds objCType:@encode(MGLCoordinateBounds)];
}
- (MGLCoordinateBounds)MGLCoordinateBoundsValue {
MGLCoordinateBounds bounds;
[self getValue:&bounds];
return bounds;
}
#pragma mark Offline maps
+ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress {
return [NSValue value:&progress withObjCType:@encode(MGLOfflinePackProgress)];
}
- (MGLOfflinePackProgress)MGLOfflinePackProgressValue {
MGLOfflinePackProgress progress;
[self getValue:&progress];
return progress;
}
@end