diff --git a/platform/darwin/include/MGLClockDirectionFormatter.h b/platform/darwin/include/MGLClockDirectionFormatter.h new file mode 100644 index 00000000000..e748a158473 --- /dev/null +++ b/platform/darwin/include/MGLClockDirectionFormatter.h @@ -0,0 +1,52 @@ +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLClockDirectionFormatter` class provides properly formatted descriptions + of headings relative to the user, known as clock positions. For + example, a value of `90` may be formatted as “3 o’clock”, depending on the + locale. + + Use this class to create localized heading strings when displaying directions + relative to the user’s current location and heading. To format a direction + irrespective of the user’s orientation, use `MGLCompassDirectionFormatter` + instead. + */ +@interface MGLClockDirectionFormatter : NSFormatter + +/** + The unit style used by this formatter. + + This property defaults to `NSFormattingUnitStyleMedium`. + */ +@property (nonatomic) NSFormattingUnitStyle unitStyle; + +/** + The locale of the receiver. + + The locale determines the output language and numeral system of the output. + */ +@property (copy) NSLocale *locale; + +/** + Returns a clock position string for the provided value. + + @param direction The heading, measured in degrees, where 0° means “straight + ahead” and 90° means “directly to your right”. + @return The clock position string appropriately formatted for the receiver’s + locale. + */ +- (NSString *)stringFromDirection:(CLLocationDirection)direction; + +/** + This method is not supported for the `MGLDirectionFormatter` class. + */ +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLCompassDirectionFormatter.h b/platform/darwin/include/MGLCompassDirectionFormatter.h new file mode 100644 index 00000000000..d7c31132913 --- /dev/null +++ b/platform/darwin/include/MGLCompassDirectionFormatter.h @@ -0,0 +1,42 @@ +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLCompassDirectionFormatter` class provides properly formatted + descriptions of absolute headings. For example, a value of `90` may be + formatted as “east”, depending on the locale. + + Use this class to create localized heading strings when displaying directions + irrespective of the user’s current location. To format a direction relative to + the user’s current location, use `MGLCompassDirectionFormatter` instead. + */ +@interface MGLCompassDirectionFormatter : NSFormatter + +/** + The unit style used by this formatter. + + This property defaults to `NSFormattingUnitStyleMedium`. + */ +@property (nonatomic) NSFormattingUnitStyle unitStyle; + +/** + Returns a heading string for the provided value. + + @param direction The heading, measured in degrees, where 0° means “due north” + and 90° means “due east”. + @return The heading string appropriately formatted for the formatter’s locale. + */ +- (NSString *)stringFromDirection:(CLLocationDirection)direction; + +/** + This method is not supported for the `MGLDirectionFormatter` class. + */ +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLCoordinateFormatter.h b/platform/darwin/include/MGLCoordinateFormatter.h new file mode 100644 index 00000000000..885471c36e0 --- /dev/null +++ b/platform/darwin/include/MGLCoordinateFormatter.h @@ -0,0 +1,31 @@ +#import +#import + +#import "MGLTypes.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + The `MGLCoordinateFormatter` class provides properly formatted descriptions of + geographic coordinate pairs. Use this class to create localized coordinate + strings when displaying location information to users. + */ +@interface MGLCoordinateFormatter : NSFormatter + +/** + Returns a coordinate string for the provided value. + + @param coordinate The coordinate’s value. + @return The coordinate string appropriately formatted for the formatter’s + locale. + */ +- (NSString *)stringFromCoordinate:(CLLocationCoordinate2D)coordinate; + +/** + This method is not supported for the `MGLCoordinateFormatter` class. + */ +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLGeometry.h b/platform/darwin/include/MGLGeometry.h index 8231eed442c..7ad51404007 100644 --- a/platform/darwin/include/MGLGeometry.h +++ b/platform/darwin/include/MGLGeometry.h @@ -95,4 +95,11 @@ NS_INLINE CLLocationDegrees MGLDegreesFromRadians(CGFloat radians) { return radians * 180 / M_PI; } +/** + Methods for round-tripping Mapbox geometry structure values. + */ +@interface NSValue (MGLGeometryAdditions) + +@end + NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLOfflinePack.h b/platform/darwin/include/MGLOfflinePack.h index 783650590ac..083e050dddf 100644 --- a/platform/darwin/include/MGLOfflinePack.h +++ b/platform/darwin/include/MGLOfflinePack.h @@ -177,25 +177,4 @@ typedef struct MGLOfflinePackProgress { @end -/** - Methods for round-tripping `MGLOfflinePackProgress` values. - */ -@interface NSValue (MGLOfflinePackAdditions) - -/** - Creates a new value object containing the given `MGLOfflinePackProgress` - structure. - - @param progress The value for the new object. - @return A new value object that contains the offline pack progress information. - */ -+ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress; - -/** - The `MGLOfflinePackProgress` structure representation of the value. - */ -@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue; - -@end - NS_ASSUME_NONNULL_END diff --git a/platform/darwin/include/MGLTypes.h b/platform/darwin/include/MGLTypes.h index 9617b069dad..746cb686c02 100644 --- a/platform/darwin/include/MGLTypes.h +++ b/platform/darwin/include/MGLTypes.h @@ -17,10 +17,15 @@ NS_ASSUME_NONNULL_BEGIN /** Indicates an error occurred in the Mapbox SDK. */ extern NSString * const MGLErrorDomain; +/** Error constants for the Mapbox SDK. */ typedef NS_ENUM(NSInteger, MGLErrorCode) { + /** An unknown error occurred. */ MGLErrorCodeUnknown = -1, + /** The resource could not be found. */ MGLErrorCodeNotFound = 1, + /** The connection received an invalid server response. */ MGLErrorCodeBadServerResponse = 2, + /** An attempt to establish a connection failed. */ MGLErrorCodeConnectionFailed = 3, }; diff --git a/platform/darwin/include/NSValue+MGLAdditions.h b/platform/darwin/include/NSValue+MGLAdditions.h new file mode 100644 index 00000000000..4a97c8e115e --- /dev/null +++ b/platform/darwin/include/NSValue+MGLAdditions.h @@ -0,0 +1,75 @@ +#import + +#import "MGLGeometry.h" +#import "MGLOfflinePack.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + Methods for round-tripping values for Mapbox-defined types. + */ +@interface NSValue (MGLAdditions) + +#pragma mark Working with Geographic Coordinate Values + +/** + Creates a new value object containing the specified Core Location geographic + coordinate structure. + + @param coordinate The value for the new object. + @return A new value object that contains the geographic coordinate information. + */ ++ (instancetype)valueWithMGLCoordinate:(CLLocationCoordinate2D)coordinate; + +/** + The Core Location geographic coordinate structure representation of the value. + */ +@property (readonly) CLLocationCoordinate2D MGLCoordinateValue; + +/** + Creates a new value object containing the specified Mapbox coordinate span + structure. + + @param span The value for the new object. + @return A new value object that contains the coordinate span information. + */ ++ (instancetype)valueWithMGLCoordinateSpan:(MGLCoordinateSpan)span; + +/** + The Mapbox coordinate span structure representation of the value. + */ +@property (readonly) MGLCoordinateSpan MGLCoordinateSpanValue; + +/** + Creates a new value object containing the specified Mapbox coordinate bounds + structure. + + @param bounds The value for the new object. + @return A new value object that contains the coordinate bounds information. + */ ++ (instancetype)valueWithMGLCoordinateBounds:(MGLCoordinateBounds)bounds; + +/** + The Mapbox coordinate bounds structure representation of the value. + */ +@property (readonly) MGLCoordinateBounds MGLCoordinateBoundsValue; + +#pragma mark Working with Offline Map Values + +/** + Creates a new value object containing the given `MGLOfflinePackProgress` + structure. + + @param progress The value for the new object. + @return A new value object that contains the offline pack progress information. + */ ++ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress; + +/** + The `MGLOfflinePackProgress` structure representation of the value. + */ +@property (readonly) MGLOfflinePackProgress MGLOfflinePackProgressValue; + +@end + +NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLClockDirectionFormatter.m b/platform/darwin/src/MGLClockDirectionFormatter.m new file mode 100644 index 00000000000..56740e74e37 --- /dev/null +++ b/platform/darwin/src/MGLClockDirectionFormatter.m @@ -0,0 +1,64 @@ +#import "MGLClockDirectionFormatter.h" + +#define wrap(value, min, max) \ + (fmod((fmod((value - min), (max - min)) + (max - min)), (max - min)) + min) + +@implementation MGLClockDirectionFormatter { + NSNumberFormatter *_numberFormatter; +} + +- (instancetype)init { + if (self = [super init]) { + _unitStyle = NSFormattingUnitStyleMedium; + _numberFormatter = [[NSNumberFormatter alloc] init]; + } + return self; +} + +- (NSLocale *)locale { + return _numberFormatter.locale; +} + +- (void)setLocale:(NSLocale *)locale { + _numberFormatter.locale = locale; +} + +- (NSString *)stringFromDirection:(CLLocationDirection)direction { + NSInteger hour = round(-wrap(-direction, -360, 0) / 360 * 12); + NSString *format; + NSNumberFormatterStyle style = NSNumberFormatterDecimalStyle; + switch (self.unitStyle) { + case NSFormattingUnitStyleShort: + format = NSLocalizedString(@"%@:00", @"Clock position format, short style"); + break; + + case NSFormattingUnitStyleMedium: + format = NSLocalizedString(@"%@ o’clock", @"Clock position format, medium style"); + + break; + + case NSFormattingUnitStyleLong: + format = NSLocalizedString(@"%@ o’clock", @"Clock position format, long style"); + style = NSNumberFormatterSpellOutStyle; + break; + + default: + break; + } + _numberFormatter.numberStyle = style; + return [NSString stringWithFormat:format, [_numberFormatter stringFromNumber:@(hour)]]; +} + +- (nullable NSString *)stringForObjectValue:(id)obj { + if (![obj isKindOfClass:[NSValue class]]) { + return nil; + } + return [self stringFromDirection:[obj doubleValue]]; +} + +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error { + NSAssert(NO, @"-getObjectValue:forString:errorDescription: has not been implemented"); + return NO; +} + +@end diff --git a/platform/darwin/src/MGLCompassDirectionFormatter.m b/platform/darwin/src/MGLCompassDirectionFormatter.m new file mode 100644 index 00000000000..efda5705a4c --- /dev/null +++ b/platform/darwin/src/MGLCompassDirectionFormatter.m @@ -0,0 +1,122 @@ +#import "MGLCompassDirectionFormatter.h" + +#define wrap(value, min, max) \ + (fmod((fmod((value - min), (max - min)) + (max - min)), (max - min)) + min) + +@implementation MGLCompassDirectionFormatter + +- (instancetype)init { + if (self = [super init]) { + _unitStyle = NSFormattingUnitStyleMedium; + } + return self; +} + +- (NSString *)stringFromDirection:(CLLocationDirection)direction { + static NS_ARRAY_OF(NSString *) *shortStrings; + static NS_ARRAY_OF(NSString *) *longStrings; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + shortStrings = @[ + NSLocalizedString(@"N", @"North, short"), + NSLocalizedString(@"N×E", @"North by east, short"), + NSLocalizedString(@"NNE", @"North-northeast, short"), + NSLocalizedString(@"NE×N", @"Northeast by north, short"), + NSLocalizedString(@"NE", @"Northeast, short"), + NSLocalizedString(@"NE×E", @"Northeast by east, short"), + NSLocalizedString(@"ENE", @"East-northeast, short"), + NSLocalizedString(@"E×N", @"East by north, short"), + + NSLocalizedString(@"E", @"East, short"), + NSLocalizedString(@"E×S", @"East by south, short"), + NSLocalizedString(@"ESE", @"East-southeast, short"), + NSLocalizedString(@"SE×E", @"Southeast by east, short"), + NSLocalizedString(@"SE", @"Southeast, short"), + NSLocalizedString(@"SE×S", @"Southeast by south, short"), + NSLocalizedString(@"SSE", @"South-southeast, short"), + NSLocalizedString(@"S×E", @"South by east, short"), + + NSLocalizedString(@"S", @"South, short"), + NSLocalizedString(@"S×W", @"South by west, short"), + NSLocalizedString(@"SSW", @"South-southwest, short"), + NSLocalizedString(@"SW×S", @"Southwest by south, short"), + NSLocalizedString(@"SW", @"Southwest, short"), + NSLocalizedString(@"SW×W", @"Southwest by west, short"), + NSLocalizedString(@"WSW", @"West-southwest, short"), + NSLocalizedString(@"W×S", @"West by south, short"), + + NSLocalizedString(@"W", @"West, short"), + NSLocalizedString(@"W×N", @"West by north, short"), + NSLocalizedString(@"WNW", @"West-northwest, short"), + NSLocalizedString(@"NW×W", @"Northwest by west, short"), + NSLocalizedString(@"NW", @"Northwest, short"), + NSLocalizedString(@"NW×N", @"Northwest by north, short"), + NSLocalizedString(@"NNW", @"North-northwest, short"), + NSLocalizedString(@"N×W", @"North by west, short"), + ]; + + longStrings = @[ + NSLocalizedString(@"north", @"North, long"), + NSLocalizedString(@"north by east", @"North by east, long"), + NSLocalizedString(@"north-northeast", @"North-northeast, long"), + NSLocalizedString(@"northeast by north", @"Northeast by north, long"), + NSLocalizedString(@"northeast", @"Northeast, long"), + NSLocalizedString(@"northeast by east", @"Northeast by east, long"), + NSLocalizedString(@"east-northeast", @"East-northeast, long"), + NSLocalizedString(@"east by north", @"East by north, long"), + + NSLocalizedString(@"east", @"East, long"), + NSLocalizedString(@"east by south", @"East by south, long"), + NSLocalizedString(@"east-southeast", @"East-southeast, long"), + NSLocalizedString(@"southeast by east", @"Southeast by east, long"), + NSLocalizedString(@"southeast", @"Southeast, long"), + NSLocalizedString(@"southeast by south", @"Southeast by south, long"), + NSLocalizedString(@"south-southeast", @"South-southeast, long"), + NSLocalizedString(@"south by east", @"South by east, long"), + + NSLocalizedString(@"south", @"South, long"), + NSLocalizedString(@"south by west", @"South by west, long"), + NSLocalizedString(@"south-southwest", @"South-southwest, long"), + NSLocalizedString(@"southwest by south", @"Southwest by south, long"), + NSLocalizedString(@"southwest", @"Southwest, long"), + NSLocalizedString(@"southwest by west", @"Southwest by west, long"), + NSLocalizedString(@"west-southwest", @"West-southwest, long"), + NSLocalizedString(@"west by south", @"West by south, long"), + + NSLocalizedString(@"west", @"West, long"), + NSLocalizedString(@"west by north", @"West by north, long"), + NSLocalizedString(@"west-northwest", @"West-northwest, long"), + NSLocalizedString(@"northwest by west", @"Northwest by west, long"), + NSLocalizedString(@"northwest", @"Northwest, long"), + NSLocalizedString(@"northwest by north", @"Northwest by north, long"), + NSLocalizedString(@"north-northwest", @"North-northwest, long"), + NSLocalizedString(@"north by west", @"North by west, long"), + ]; + + NSAssert(shortStrings.count == longStrings.count, @"Long and short compass direction string arrays must have the same size."); + }); + + NSInteger cardinalPoint = round(wrap(direction, 0, 360) / 360 * shortStrings.count); + switch (self.unitStyle) { + case NSFormattingUnitStyleShort: + return shortStrings[cardinalPoint]; + + case NSFormattingUnitStyleMedium: + case NSFormattingUnitStyleLong: + return longStrings[cardinalPoint]; + } +} + +- (nullable NSString *)stringForObjectValue:(id)obj { + if (![obj isKindOfClass:[NSValue class]]) { + return nil; + } + return [self stringFromDirection:[obj doubleValue]]; +} + +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error { + NSAssert(NO, @"-getObjectValue:forString:errorDescription: has not been implemented"); + return NO; +} + +@end diff --git a/platform/darwin/src/MGLCoordinateFormatter.m b/platform/darwin/src/MGLCoordinateFormatter.m new file mode 100644 index 00000000000..259917717fb --- /dev/null +++ b/platform/darwin/src/MGLCoordinateFormatter.m @@ -0,0 +1,60 @@ +#import "MGLCoordinateFormatter.h" + +#import "NSValue+MGLAdditions.h" + +@implementation MGLCoordinateFormatter { + NSNumberFormatter *_numberFormatter; +} + +- (instancetype)init { + if (self = [super init]) { + _numberFormatter = [[NSNumberFormatter alloc] init]; + _numberFormatter.numberStyle = NSNumberFormatterDecimalStyle; + _numberFormatter.maximumFractionDigits = 0; + } + return self; +} + +- (NSString *)stringFromCoordinate:(CLLocationCoordinate2D)coordinate { + return [NSString stringWithFormat:NSLocalizedString(@"%@, %@", @"Latitude, longitude format"), + [self stringFromLocationDegrees:coordinate.latitude + positiveFormat:NSLocalizedString(@"%@N", @"North latitude format") + negativeFormat:NSLocalizedString(@"%@S", @"South latitude format")], + [self stringFromLocationDegrees:coordinate.longitude + positiveFormat:NSLocalizedString(@"%@E", @"East longitude format") + negativeFormat:NSLocalizedString(@"%@W", @"West longitude format")]]; +} + +- (NSString *)stringFromLocationDegrees:(CLLocationDegrees)degrees positiveFormat:(NSString *)positiveFormat negativeFormat:(NSString *)negativeFormat { + CLLocationDegrees minutes = (fabs(degrees) - floor(fabs(degrees))) * 60; + CLLocationDegrees seconds = (minutes - floor(minutes)) * 60; + + NSMutableString *string = [NSMutableString stringWithFormat:NSLocalizedString(@"%@°", @"Degrees of arc format"), + [_numberFormatter stringFromNumber:@(floor(fabs(degrees)))]]; + if (trunc(minutes) > 0 || trunc(seconds) > 0) { + [string appendFormat:NSLocalizedString(@"%@′", @"Arcminutes format"), + [_numberFormatter stringFromNumber:@(floor(minutes))]]; + } + if (trunc(seconds) > 0) { + [string appendFormat:NSLocalizedString(@"%@″", @"Arcseconds format"), + [_numberFormatter stringFromNumber:@(seconds)]]; + } + if (degrees == 0) { + return string; + } + return [NSString stringWithFormat:degrees > 0 ? positiveFormat : negativeFormat, string]; +} + +- (nullable NSString *)stringForObjectValue:(id)obj { + if (![obj isKindOfClass:[NSValue class]]) { + return nil; + } + return [self stringFromCoordinate:[obj MGLCoordinateValue]]; +} + +- (BOOL)getObjectValue:(out id __nullable * __nullable)obj forString:(NSString *)string errorDescription:(out NSString * __nullable * __nullable)error { + NSAssert(NO, @"-getObjectValue:forString:errorDescription: has not been implemented"); + return NO; +} + +@end diff --git a/platform/darwin/src/MGLOfflinePack.mm b/platform/darwin/src/MGLOfflinePack.mm index 13032a6ec67..9c8396f7285 100644 --- a/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/darwin/src/MGLOfflinePack.mm @@ -202,17 +202,3 @@ - (void)offlineRegionStatusDidChange:(mbgl::OfflineRegionStatus)status { [pack.delegate offlinePack:pack didReceiveMaximumAllowedMapboxTiles:limit]; }); } - -@implementation NSValue (MGLOfflinePackAdditions) - -+ (NSValue *)valueWithMGLOfflinePackProgress:(MGLOfflinePackProgress)progress { - return [NSValue value:&progress withObjCType:@encode(MGLOfflinePackProgress)]; -} - -- (MGLOfflinePackProgress)MGLOfflinePackProgressValue { - MGLOfflinePackProgress progress; - [self getValue:&progress]; - return progress; -} - -@end diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 89bf0502497..f09b03def1d 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -5,6 +5,7 @@ #import "MGLOfflinePack_Private.h" #import "MGLOfflineRegion_Private.h" #import "MGLTilePyramidOfflineRegion.h" +#import "NSValue+MGLAdditions.h" #include diff --git a/platform/darwin/src/NSValue+MGLAdditions.m b/platform/darwin/src/NSValue+MGLAdditions.m new file mode 100644 index 00000000000..0d2128bea83 --- /dev/null +++ b/platform/darwin/src/NSValue+MGLAdditions.m @@ -0,0 +1,49 @@ +#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 diff --git a/platform/darwin/test/MGLClockDirectionFormatterTests.m b/platform/darwin/test/MGLClockDirectionFormatterTests.m new file mode 100644 index 00000000000..b85f4bed8c7 --- /dev/null +++ b/platform/darwin/test/MGLClockDirectionFormatterTests.m @@ -0,0 +1,49 @@ +#import +#import + +static NSString * const MGLTestLocaleIdentifier = @"en-US"; + +@interface MGLClockDirectionFormatterTests : XCTestCase + +@end + +@implementation MGLClockDirectionFormatterTests + +- (void)testClockDirections { + MGLClockDirectionFormatter *shortFormatter = [[MGLClockDirectionFormatter alloc] init]; + shortFormatter.unitStyle = NSFormattingUnitStyleShort; + shortFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier]; + + MGLClockDirectionFormatter *mediumFormatter = [[MGLClockDirectionFormatter alloc] init]; + mediumFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier]; + + MGLClockDirectionFormatter *longFormatter = [[MGLClockDirectionFormatter alloc] init]; + longFormatter.unitStyle = NSFormattingUnitStyleLong; + longFormatter.locale = [NSLocale localeWithLocaleIdentifier:MGLTestLocaleIdentifier]; + + XCTAssertEqualObjects(@"9:00", [shortFormatter stringFromDirection:-90]); + XCTAssertEqualObjects(@"9 o’clock", [mediumFormatter stringFromDirection:-90]); + XCTAssertEqualObjects(@"nine o’clock", [longFormatter stringFromDirection:-90]); + + XCTAssertEqualObjects(@"12:00", [shortFormatter stringFromDirection:0]); + XCTAssertEqualObjects(@"12 o’clock", [mediumFormatter stringFromDirection:0]); + XCTAssertEqualObjects(@"twelve o’clock", [longFormatter stringFromDirection:0]); + + XCTAssertEqualObjects(@"2:00", [shortFormatter stringFromDirection:45]); + XCTAssertEqualObjects(@"2 o’clock", [mediumFormatter stringFromDirection:45]); + XCTAssertEqualObjects(@"two o’clock", [longFormatter stringFromDirection:45]); + + XCTAssertEqualObjects(@"3:00", [shortFormatter stringFromDirection:90]); + XCTAssertEqualObjects(@"3 o’clock", [mediumFormatter stringFromDirection:90]); + XCTAssertEqualObjects(@"three o’clock", [longFormatter stringFromDirection:90]); + + XCTAssertEqualObjects(@"6:00", [shortFormatter stringFromDirection:180]); + XCTAssertEqualObjects(@"6 o’clock", [mediumFormatter stringFromDirection:180]); + XCTAssertEqualObjects(@"six o’clock", [longFormatter stringFromDirection:180]); + + XCTAssertEqualObjects(@"9:00", [shortFormatter stringFromDirection:270]); + XCTAssertEqualObjects(@"9 o’clock", [mediumFormatter stringFromDirection:270]); + XCTAssertEqualObjects(@"nine o’clock", [longFormatter stringFromDirection:270]); +} + +@end diff --git a/platform/darwin/test/MGLCompassDirectionFormatterTests.m b/platform/darwin/test/MGLCompassDirectionFormatterTests.m new file mode 100644 index 00000000000..034e07818bd --- /dev/null +++ b/platform/darwin/test/MGLCompassDirectionFormatterTests.m @@ -0,0 +1,65 @@ +#import +#import + +@interface MGLCompassDirectionFormatterTests : XCTestCase + +@end + +@implementation MGLCompassDirectionFormatterTests + +- (void)testCompassDirections { + MGLCompassDirectionFormatter *shortFormatter = [[MGLCompassDirectionFormatter alloc] init]; + shortFormatter.unitStyle = NSFormattingUnitStyleShort; + + MGLCompassDirectionFormatter *mediumFormatter = [[MGLCompassDirectionFormatter alloc] init]; + XCTAssertEqual(mediumFormatter.unitStyle, NSFormattingUnitStyleMedium, @"Unit style should be medium by default."); + + MGLCompassDirectionFormatter *longFormatter = [[MGLCompassDirectionFormatter alloc] init]; + longFormatter.unitStyle = NSFormattingUnitStyleLong; + + XCTAssertEqualObjects(@"NW", [shortFormatter stringFromDirection:-45]); + XCTAssertEqualObjects(@"northwest", [mediumFormatter stringFromDirection:-45]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:-45], [longFormatter stringFromDirection:-45]); + + XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:0]); + XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:0]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:0], [longFormatter stringFromDirection:0]); + + XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:1]); + XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:1]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:1], [longFormatter stringFromDirection:1]); + + XCTAssertEqualObjects(@"N×E", [shortFormatter stringFromDirection:10]); + XCTAssertEqualObjects(@"north by east", [mediumFormatter stringFromDirection:10]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:10], [longFormatter stringFromDirection:10]); + + XCTAssertEqualObjects(@"NNE", [shortFormatter stringFromDirection:20]); + XCTAssertEqualObjects(@"north-northeast", [mediumFormatter stringFromDirection:20]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:20], [longFormatter stringFromDirection:20]); + + XCTAssertEqualObjects(@"NE", [shortFormatter stringFromDirection:45]); + XCTAssertEqualObjects(@"northeast", [mediumFormatter stringFromDirection:45]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:45], [longFormatter stringFromDirection:45]); + + XCTAssertEqualObjects(@"E", [shortFormatter stringFromDirection:90]); + XCTAssertEqualObjects(@"east", [mediumFormatter stringFromDirection:90]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:90], [longFormatter stringFromDirection:90]); + + XCTAssertEqualObjects(@"S", [shortFormatter stringFromDirection:180]); + XCTAssertEqualObjects(@"south", [mediumFormatter stringFromDirection:180]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:180], [longFormatter stringFromDirection:180]); + + XCTAssertEqualObjects(@"W", [shortFormatter stringFromDirection:270]); + XCTAssertEqualObjects(@"west", [mediumFormatter stringFromDirection:270]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:270], [longFormatter stringFromDirection:270]); + + XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:360]); + XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:360]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:360], [longFormatter stringFromDirection:360]); + + XCTAssertEqualObjects(@"N", [shortFormatter stringFromDirection:720]); + XCTAssertEqualObjects(@"north", [mediumFormatter stringFromDirection:720]); + XCTAssertEqualObjects([mediumFormatter stringFromDirection:720], [longFormatter stringFromDirection:720]); +} + +@end diff --git a/platform/darwin/test/MGLCoordinateFormatterTests.m b/platform/darwin/test/MGLCoordinateFormatterTests.m new file mode 100644 index 00000000000..84a17596b19 --- /dev/null +++ b/platform/darwin/test/MGLCoordinateFormatterTests.m @@ -0,0 +1,15 @@ +#import +#import + +@interface MGLCoordinateFormatterTests : XCTestCase + +@end + +@implementation MGLCoordinateFormatterTests + +- (void)testStrings { + MGLCoordinateFormatter *formatter = [[MGLCoordinateFormatter alloc] init]; + XCTAssertEqualObjects([formatter stringFromCoordinate:CLLocationCoordinate2DMake(38.9131982, -77.0325453144239)], @"38°54′48″N, 77°1′57″W"); +} + +@end diff --git a/platform/darwin/test/MGLGeometryTests.mm b/platform/darwin/test/MGLGeometryTests.mm index 73af0bb2114..e76c67c5c10 100644 --- a/platform/darwin/test/MGLGeometryTests.mm +++ b/platform/darwin/test/MGLGeometryTests.mm @@ -1,7 +1,8 @@ -#import "../../darwin/src/MGLGeometry_Private.h" - +#import #import +#import "../../darwin/src/MGLGeometry_Private.h" + @interface MGLGeometryTests : XCTestCase @end @@ -52,4 +53,29 @@ - (void)testAltitudeConversions { XCTAssertEqualWithAccuracy(18, MGLZoomLevelForAltitude(MGLAltitudeForZoomLevel(18, 60, 40, midSize), 60, 40, midSize), 3); } +- (void)testGeometryBoxing { + CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239); + CLLocationCoordinate2D roundTrippedCoordinate = [NSValue valueWithMGLCoordinate:coordinate].MGLCoordinateValue; + + XCTAssertEqual(coordinate.latitude, roundTrippedCoordinate.latitude, @"Latitude should round-trip."); + XCTAssertEqual(coordinate.longitude, roundTrippedCoordinate.longitude, @"Longitude should round-trip."); + + MGLCoordinateSpan span = MGLCoordinateSpanMake(4.383333333333335, -4.299999999999997); + MGLCoordinateSpan roundTrippedSpan = [NSValue valueWithMGLCoordinateSpan:span].MGLCoordinateSpanValue; + + XCTAssertEqual(span.latitudeDelta, roundTrippedSpan.latitudeDelta, @"Latitude delta should round-trip."); + XCTAssertEqual(span.longitudeDelta, roundTrippedSpan.longitudeDelta, @"Longitude delta should round-trip."); + + MGLCoordinateBounds bounds = MGLCoordinateBoundsMake(CLLocationCoordinate2DMake(38.9131982, -77.0325453144239), + CLLocationCoordinate2DMake(37.7757368, -122.4135302)); + MGLCoordinateBounds roundTrippedBounds = [NSValue valueWithMGLCoordinateBounds:bounds].MGLCoordinateBoundsValue; + + XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:bounds.sw], + [NSValue valueWithMGLCoordinate:roundTrippedBounds.sw], + @"Southwest should round-trip."); + XCTAssertEqualObjects([NSValue valueWithMGLCoordinate:bounds.ne], + [NSValue valueWithMGLCoordinate:roundTrippedBounds.ne], + @"Northeast should round-trip."); +} + @end diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index e84590e7dc2..ba1c6351750 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -11,6 +11,8 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON - Setting the `image` property of an MGLAnnotationImage to `nil` resets it to the default red pin image and reclaims resources that can be used to customize additional annotations. ([#3835](https://github.com/mapbox/mapbox-gl-native/pull/3835)) - Fixed an issue preventing KVO change notifications from being generated on MGLMapView’s `userTrackingMode` key path when `-setUserTrackingMode:animated:` is called. ([#4724](https://github.com/mapbox/mapbox-gl-native/pull/4724)) - Rendering now occurs on the main thread, fixing a hang when calling `-[MGLMapView styleURL]` before the map view has fully loaded or while the application is in the background. ([#2909](https://github.com/mapbox/mapbox-gl-native/pull/2909)) +- Added category methods on NSValue for converting to and from the structure types defined in MGLGeometry.h. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802)) +- Added NSFormatter subclasses for converting geographic coordinates and directions into display strings. ([#4802](https://github.com/mapbox/mapbox-gl-native/pull/4802)) - Added a `-reloadStyle:` action to MGLMapView to force a reload of the current style. ([#4728](https://github.com/mapbox/mapbox-gl-native/pull/4728)) - A more specific user agent string is now sent with style and tile requests. ([#4012](https://github.com/mapbox/mapbox-gl-native/pull/4012)) - Mapbox Telemetry is automatically disabled while the host application is running in the iOS Simulator. ([#4726](https://github.com/mapbox/mapbox-gl-native/pull/4726)) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index d8bdc6d99e2..f6e0cc0ae86 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -450,7 +450,7 @@ - (IBAction)handleLongPress:(UILongPressGestureRecognizer *)longPress point.coordinate = [self.mapView convertPoint:[longPress locationInView:longPress.view] toCoordinateFromView:self.mapView]; point.title = @"Dropped Marker"; - point.subtitle = [NSString stringWithFormat:@"lat: %.3f, lon: %.3f", point.coordinate.latitude, point.coordinate.longitude]; + point.subtitle = [[[MGLCoordinateFormatter alloc] init] stringFromCoordinate:point.coordinate]; [self.mapView addAnnotation:point]; [self.mapView selectAnnotation:point animated:YES]; } diff --git a/platform/ios/framework/Mapbox.h b/platform/ios/framework/Mapbox.h deleted file mode 100644 index 7b233ecac57..00000000000 --- a/platform/ios/framework/Mapbox.h +++ /dev/null @@ -1,30 +0,0 @@ -#import - -/// Project version number for Mapbox. -FOUNDATION_EXPORT double MapboxVersionNumber; - -/// Project version string for Mapbox. -FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; - -#import "MGLAccountManager.h" -#import "MGLAnnotation.h" -#import "MGLAnnotationImage.h" -#import "MGLCalloutView.h" -#import "MGLMapCamera.h" -#import "MGLGeometry.h" -#import "MGLMapView.h" -#import "MGLMapView+IBAdditions.h" -#import "MGLMapView+MGLCustomStyleLayerAdditions.h" -#import "MGLMultiPoint.h" -#import "MGLOfflinePack.h" -#import "MGLOfflineRegion.h" -#import "MGLOfflineStorage.h" -#import "MGLOverlay.h" -#import "MGLPointAnnotation.h" -#import "MGLPolygon.h" -#import "MGLPolyline.h" -#import "MGLShape.h" -#import "MGLStyle.h" -#import "MGLTilePyramidOfflineRegion.h" -#import "MGLTypes.h" -#import "MGLUserLocation.h" diff --git a/platform/ios/include/Mapbox.h b/platform/ios/include/Mapbox.h index fb25a0104e3..df08c1b4a22 100644 --- a/platform/ios/include/Mapbox.h +++ b/platform/ios/include/Mapbox.h @@ -1,9 +1,20 @@ +#import + +/// Project version number for Mapbox. +FOUNDATION_EXPORT double MapboxVersionNumber; + +/// Project version string for Mapbox. +FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; + #import "MGLAccountManager.h" #import "MGLAnnotation.h" #import "MGLAnnotationImage.h" #import "MGLCalloutView.h" -#import "MGLGeometry.h" +#import "MGLClockDirectionFormatter.h" +#import "MGLCompassDirectionFormatter.h" +#import "MGLCoordinateFormatter.h" #import "MGLMapCamera.h" +#import "MGLGeometry.h" #import "MGLMapView.h" #import "MGLMapView+IBAdditions.h" #import "MGLMapView+MGLCustomStyleLayerAdditions.h" @@ -20,3 +31,4 @@ #import "MGLTilePyramidOfflineRegion.h" #import "MGLTypes.h" #import "MGLUserLocation.h" +#import "NSValue+MGLAdditions.h" diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 776fea38896..9f12dda7819 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -28,6 +28,25 @@ DA2E88631CC0382C00F24E7B /* MGLOfflineRegionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2E885E1CC0382C00F24E7B /* MGLOfflineRegionTests.m */; }; DA2E88641CC0382C00F24E7B /* MGLOfflineStorageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA2E885F1CC0382C00F24E7B /* MGLOfflineStorageTests.m */; }; DA2E88651CC0382C00F24E7B /* MGLStyleTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA2E88601CC0382C00F24E7B /* MGLStyleTests.mm */; }; + DA35A29E1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A29F1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */; }; + DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */; }; + DA35A2AA1CCA058D00E826B2 /* MGLCoordinateFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */; }; + DA35A2B11CCA141D00E826B2 /* MGLCompassDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2AF1CCA141D00E826B2 /* MGLCompassDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2B21CCA141D00E826B2 /* MGLCompassDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2AF1CCA141D00E826B2 /* MGLCompassDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2B31CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */; }; + DA35A2B41CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */; }; + DA35A2B81CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B71CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m */; }; + DA35A2B91CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B71CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m */; }; + DA35A2BB1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2BA1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2BC1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2BA1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2C51CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C31CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m */; }; + DA35A2C61CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C41CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m */; }; + DA35A2C91CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2CA1CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2CB1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */; }; + DA35A2CC1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */; }; DA4A26941CB6E337000B7809 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC9561CB6C1C2006E619F /* Main.storyboard */; }; DA4A26951CB6E337000B7809 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA1DC95B1CB6C1C2006E619F /* LaunchScreen.storyboard */; }; DA8847D91CBAF91600AB86E3 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; @@ -269,6 +288,18 @@ DA2E885E1CC0382C00F24E7B /* MGLOfflineRegionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineRegionTests.m; path = ../../darwin/test/MGLOfflineRegionTests.m; sourceTree = ""; }; DA2E885F1CC0382C00F24E7B /* MGLOfflineStorageTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflineStorageTests.m; path = ../../darwin/test/MGLOfflineStorageTests.m; sourceTree = ""; }; DA2E88601CC0382C00F24E7B /* MGLStyleTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLStyleTests.mm; path = ../../darwin/test/MGLStyleTests.mm; sourceTree = ""; }; + DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCoordinateFormatter.h; path = include/MGLCoordinateFormatter.h; sourceTree = ""; }; + DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatter.m; path = src/MGLCoordinateFormatter.m; sourceTree = ""; }; + DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatterTests.m; path = ../../darwin/test/MGLCoordinateFormatterTests.m; sourceTree = ""; }; + DA35A2AF1CCA141D00E826B2 /* MGLCompassDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCompassDirectionFormatter.h; path = include/MGLCompassDirectionFormatter.h; sourceTree = ""; }; + DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompassDirectionFormatter.m; path = src/MGLCompassDirectionFormatter.m; sourceTree = ""; }; + DA35A2B71CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLClockDirectionFormatter.m; path = src/MGLClockDirectionFormatter.m; sourceTree = ""; }; + DA35A2BA1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLClockDirectionFormatter.h; path = include/MGLClockDirectionFormatter.h; sourceTree = ""; }; + DA35A2C31CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLClockDirectionFormatterTests.m; path = ../../darwin/test/MGLClockDirectionFormatterTests.m; sourceTree = ""; }; + DA35A2C41CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompassDirectionFormatterTests.m; path = ../../darwin/test/MGLCompassDirectionFormatterTests.m; sourceTree = ""; }; + DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSValue+MGLAdditions.h"; path = "include/NSValue+MGLAdditions.h"; sourceTree = ""; }; + DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSValue+MGLAdditions.m"; path = "src/NSValue+MGLAdditions.m"; sourceTree = ""; }; + DA35A2D11CCAB25200E826B2 /* jazzy.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = jazzy.yml; sourceTree = ""; }; DA4A26961CB6E795000B7809 /* Mapbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA8847D21CBAF91600AB86E3 /* Mapbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DA8847D61CBAF91600AB86E3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -335,7 +366,7 @@ DA88484C1CBAFB9800AB86E3 /* MGLUserLocation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLUserLocation.m; path = src/MGLUserLocation.m; sourceTree = ""; }; DA88484D1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLUserLocationAnnotationView.h; path = src/MGLUserLocationAnnotationView.h; sourceTree = ""; }; DA88484E1CBAFB9800AB86E3 /* MGLUserLocationAnnotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLUserLocationAnnotationView.m; path = src/MGLUserLocationAnnotationView.m; sourceTree = ""; }; - DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mapbox.h; sourceTree = ""; }; + DA88485E1CBAFC2E00AB86E3 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Mapbox.h; path = ../include/Mapbox.h; sourceTree = ""; }; DA8848631CBAFCC100AB86E3 /* Compass.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Compass.png; sourceTree = ""; }; DA8848641CBAFCC100AB86E3 /* Compass@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Compass@2x.png"; sourceTree = ""; }; DA8848651CBAFCC100AB86E3 /* Compass@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Compass@3x.png"; sourceTree = ""; }; @@ -377,7 +408,7 @@ DABCABBB1CB80692000A7C39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DABCABBF1CB80717000A7C39 /* locations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = locations.cpp; sourceTree = ""; }; DABCABC01CB80717000A7C39 /* locations.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = locations.hpp; sourceTree = ""; }; - DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = "../../build/ios/mbgl.xcconfig"; sourceTree = ""; }; + DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = ../../build/ios/mbgl.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -503,6 +534,9 @@ DA2E88521CC036F400F24E7B /* SDK Tests */ = { isa = PBXGroup; children = ( + DA35A2C31CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m */, + DA35A2C41CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m */, + DA35A2A91CCA058D00E826B2 /* MGLCoordinateFormatterTests.m */, DA2E885C1CC0382C00F24E7B /* MGLGeometryTests.mm */, DA2E885D1CC0382C00F24E7B /* MGLOfflinePackTests.m */, DA2E885E1CC0382C00F24E7B /* MGLOfflineRegionTests.m */, @@ -534,6 +568,12 @@ DA8847FF1CBAFA6200AB86E3 /* MGLAccountManager_Private.h */, DA8848001CBAFA6200AB86E3 /* MGLAccountManager.m */, DA8847E01CBAFA5100AB86E3 /* MGLAnnotation.h */, + DA35A2BA1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h */, + DA35A2B71CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m */, + DA35A2AF1CCA141D00E826B2 /* MGLCompassDirectionFormatter.h */, + DA35A2B01CCA141D00E826B2 /* MGLCompassDirectionFormatter.m */, + DA35A29D1CC9E94C00E826B2 /* MGLCoordinateFormatter.h */, + DA35A2A01CC9E95F00E826B2 /* MGLCoordinateFormatter.m */, DA8847E11CBAFA5100AB86E3 /* MGLGeometry.h */, DA8848011CBAFA6200AB86E3 /* MGLGeometry_Private.h */, DA8848021CBAFA6200AB86E3 /* MGLGeometry.mm */, @@ -572,6 +612,8 @@ DA8848161CBAFA6200AB86E3 /* NSProcessInfo+MGLAdditions.m */, DA8848171CBAFA6200AB86E3 /* NSString+MGLAdditions.h */, DA8848181CBAFA6200AB86E3 /* NSString+MGLAdditions.m */, + DA35A2C71CCAAAD200E826B2 /* NSValue+MGLAdditions.h */, + DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */, DA8848911CBB049300AB86E3 /* reachability */, ); name = Foundation; @@ -703,6 +745,7 @@ DAC07C951CBB2CAD000CB309 /* Configuration */ = { isa = PBXGroup; children = ( + DA35A2D11CCAB25200E826B2 /* jazzy.yml */, DAC07C961CBB2CD6000CB309 /* mbgl.xcconfig */, ); name = Configuration; @@ -716,6 +759,7 @@ buildActionMask = 2147483647; files = ( DA88483A1CBAFB8500AB86E3 /* MGLAnnotationImage.h in Headers */, + DA35A2BB1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */, DA8848861CBB033F00AB86E3 /* Fabric+FABKits.h in Headers */, DA8848201CBAFA6200AB86E3 /* MGLOfflinePack_Private.h in Headers */, DA8847FA1CBAFA5100AB86E3 /* MGLPolyline.h in Headers */, @@ -732,6 +776,7 @@ DA88483E1CBAFB8500AB86E3 /* MGLMapView+MGLCustomStyleLayerAdditions.h in Headers */, DA8847EF1CBAFA5100AB86E3 /* MGLAccountManager.h in Headers */, DA8848511CBAFB9800AB86E3 /* MGLAPIClient.h in Headers */, + DA35A2C91CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */, DA8848571CBAFB9800AB86E3 /* MGLMapboxEvents.h in Headers */, DA8848311CBAFA6200AB86E3 /* NSString+MGLAdditions.h in Headers */, DA8847F41CBAFA5100AB86E3 /* MGLOfflinePack.h in Headers */, @@ -741,7 +786,9 @@ DA88483D1CBAFB8500AB86E3 /* MGLMapView+IBAdditions.h in Headers */, DA17BE301CC4BAC300402C41 /* MGLMapView_Internal.h in Headers */, DA88481E1CBAFA6200AB86E3 /* MGLMultiPoint_Private.h in Headers */, + DA35A29E1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */, DA8847F71CBAFA5100AB86E3 /* MGLOverlay.h in Headers */, + DA35A2B11CCA141D00E826B2 /* MGLCompassDirectionFormatter.h in Headers */, DA88488B1CBB037E00AB86E3 /* SMCalloutView.h in Headers */, DA8847FE1CBAFA5100AB86E3 /* MGLTypes.h in Headers */, DA8847F11CBAFA5100AB86E3 /* MGLGeometry.h in Headers */, @@ -769,8 +816,10 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + DA35A2CA1CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */, DABFB85E1CBE99E500D62B32 /* MGLAnnotation.h in Headers */, DABFB8641CBE99E500D62B32 /* MGLOfflineStorage.h in Headers */, + DA35A29F1CC9E94C00E826B2 /* MGLCoordinateFormatter.h in Headers */, DABFB8711CBE9A0F00D62B32 /* MGLMapView+MGLCustomStyleLayerAdditions.h in Headers */, DABFB8611CBE99E500D62B32 /* MGLMultiPoint.h in Headers */, DABFB86D1CBE9A0F00D62B32 /* MGLAnnotationImage.h in Headers */, @@ -786,10 +835,12 @@ DABFB8681CBE99E500D62B32 /* MGLPolyline.h in Headers */, DABFB86F1CBE9A0F00D62B32 /* MGLMapView.h in Headers */, DABFB8631CBE99E500D62B32 /* MGLOfflineRegion.h in Headers */, + DA35A2B21CCA141D00E826B2 /* MGLCompassDirectionFormatter.h in Headers */, DABFB8731CBE9A9900D62B32 /* Mapbox.h in Headers */, DABFB86B1CBE99E500D62B32 /* MGLTilePyramidOfflineRegion.h in Headers */, DABFB85F1CBE99E500D62B32 /* MGLGeometry.h in Headers */, DABFB85D1CBE99E500D62B32 /* MGLAccountManager.h in Headers */, + DA35A2BC1CCA9A6900E826B2 /* MGLClockDirectionFormatter.h in Headers */, DABFB86E1CBE9A0F00D62B32 /* MGLCalloutView.h in Headers */, DABFB8601CBE99E500D62B32 /* MGLMapCamera.h in Headers */, DABFB86A1CBE99E500D62B32 /* MGLStyle.h in Headers */, @@ -1018,7 +1069,10 @@ DA2E88651CC0382C00F24E7B /* MGLStyleTests.mm in Sources */, DA2E88611CC0382C00F24E7B /* MGLGeometryTests.mm in Sources */, DA2E88641CC0382C00F24E7B /* MGLOfflineStorageTests.m in Sources */, + DA35A2C61CCA9F8300E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */, + DA35A2C51CCA9F8300E826B2 /* MGLClockDirectionFormatterTests.m in Sources */, DA2E88621CC0382C00F24E7B /* MGLOfflinePackTests.m in Sources */, + DA35A2AA1CCA058D00E826B2 /* MGLCoordinateFormatterTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1032,12 +1086,16 @@ DA88482D1CBAFA6200AB86E3 /* NSBundle+MGLAdditions.m in Sources */, DA88485B1CBAFB9800AB86E3 /* MGLUserLocation.m in Sources */, DA88488C1CBB037E00AB86E3 /* SMCalloutView.m in Sources */, + DA35A2B81CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DA8848901CBB048E00AB86E3 /* reachability.m in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, DA8848591CBAFB9800AB86E3 /* MGLMapView.mm in Sources */, DA8848501CBAFB9800AB86E3 /* MGLAnnotationImage.m in Sources */, DA8848281CBAFA6200AB86E3 /* MGLShape.m in Sources */, + DA35A2B31CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */, + DA35A2CB1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */, DA8848321CBAFA6200AB86E3 /* NSString+MGLAdditions.m in Sources */, + DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, DA8848291CBAFA6200AB86E3 /* MGLStyle.mm in Sources */, DA88481C1CBAFA6200AB86E3 /* MGLGeometry.mm in Sources */, DA88481F1CBAFA6200AB86E3 /* MGLMultiPoint.mm in Sources */, @@ -1065,12 +1123,16 @@ DAA4E4201CBB730400178DFB /* MGLOfflinePack.mm in Sources */, DAA4E4331CBB730400178DFB /* MGLUserLocation.m in Sources */, DAA4E4351CBB730400178DFB /* SMCalloutView.m in Sources */, + DA35A2B91CCA9A5D00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAA4E4251CBB730400178DFB /* MGLShape.m in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, DAA4E41F1CBB730400178DFB /* MGLMultiPoint.mm in Sources */, + DA35A2B41CCA141D00E826B2 /* MGLCompassDirectionFormatter.m in Sources */, + DA35A2CC1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */, DAA4E4281CBB730400178DFB /* MGLTypes.m in Sources */, + DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, DAA4E42D1CBB730400178DFB /* MGLAnnotationImage.m in Sources */, DAA4E4301CBB730400178DFB /* MGLLocationManager.m in Sources */, DAA4E4321CBB730400178DFB /* MGLMapView.mm in Sources */, @@ -1188,7 +1250,7 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; - SYMROOT = "../../build/ios"; + SYMROOT = ../../build/ios; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1227,7 +1289,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 7.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SYMROOT = "../../build/ios"; + SYMROOT = ../../build/ios; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; diff --git a/.jazzy.yaml b/platform/ios/jazzy.yml similarity index 92% rename from .jazzy.yaml rename to platform/ios/jazzy.yml index 216fd82ae28..4199e3ec330 100644 --- a/.jazzy.yaml +++ b/platform/ios/jazzy.yml @@ -15,10 +15,11 @@ umbrella_header: platform/ios/include/Mapbox.h framework_root: platform/darwin/include custom_categories: - - name: Map + - name: Maps children: - MGLAccountManager - MGLMapCamera + - MGLMapDebugMaskOptions - MGLMapView - MGLMapViewDelegate - MGLStyle @@ -37,7 +38,7 @@ custom_categories: - MGLOverlay - MGLShape - MGLUserLocation - - name: Offline Storage + - name: Offline Maps children: - MGLOfflineRegion - MGLOfflineStorage @@ -54,15 +55,17 @@ custom_categories: - MGLOfflinePackState - MGLOfflinePackStateUserInfoKey - MGLTilePyramidOfflineRegion - - NSValue(MGLOfflinePackAdditions) - name: Geometry children: + - MGLClockDirectionFormatter + - MGLCompassDirectionFormatter - MGLCoordinateBounds - MGLCoordinateBoundsEqualToCoordinateBounds - MGLCoordinateBoundsGetCoordinateSpan - MGLCoordinateBoundsIsEmpty - MGLCoordinateBoundsMake - MGLCoordinateBoundsOffset + - MGLCoordinateFormatter - MGLCoordinateSpan - MGLCoordinateSpanEqualToCoordinateSpan - MGLCoordinateSpanMake diff --git a/platform/ios/scripts/document.sh b/platform/ios/scripts/document.sh index 4890aca15c9..8100ff10db6 100755 --- a/platform/ios/scripts/document.sh +++ b/platform/ios/scripts/document.sh @@ -33,6 +33,7 @@ rm -rf ${OUTPUT} mkdir -p ${OUTPUT} jazzy \ + --config platform/ios/jazzy.yml --sdk iphonesimulator \ --swift-version $SWIFT_VERSION \ --github-file-prefix https://github.com/mapbox/mapbox-gl-native/tree/${BRANCH} \ diff --git a/platform/osx/app/DroppedPinAnnotation.m b/platform/osx/app/DroppedPinAnnotation.m index a103ec923c9..5b19fd7401e 100644 --- a/platform/osx/app/DroppedPinAnnotation.m +++ b/platform/osx/app/DroppedPinAnnotation.m @@ -2,21 +2,27 @@ #import "LocationCoordinate2DTransformer.h" #import "TimeIntervalTransformer.h" -#import "NSValue+Additions.h" + +#import + +static MGLCoordinateFormatter *DroppedPinCoordinateFormatter; @implementation DroppedPinAnnotation { NSTimer *_timer; NSTimeInterval _priorShownTimeInterval; NSDate *_dateShown; - NSValueTransformer *_coordinateTransformer; NSValueTransformer *_timeIntervalTransformer; } ++ (void)initialize { + if (self == [DroppedPinAnnotation class]) { + DroppedPinCoordinateFormatter = [[MGLCoordinateFormatter alloc] init]; + } +} + - (instancetype)init { if (self = [super init]) { - _coordinateTransformer = [NSValueTransformer valueTransformerForName: - NSStringFromClass([LocationCoordinate2DTransformer class])]; _timeIntervalTransformer = [NSValueTransformer valueTransformerForName: NSStringFromClass([TimeIntervalTransformer class])]; [self update:nil]; @@ -54,8 +60,7 @@ - (void)pause { } - (void)update:(NSTimer *)timer { - NSString *coordinate = [_coordinateTransformer transformedValue: - [NSValue valueWithCLLocationCoordinate2D:self.coordinate]]; + NSString *coordinate = [DroppedPinCoordinateFormatter stringFromCoordinate:self.coordinate]; NSString *elapsedTime = [_timeIntervalTransformer transformedValue:@(self.elapsedShownTime)]; self.subtitle = [NSString stringWithFormat:@"%@\nSelected for %@", coordinate, elapsedTime]; } diff --git a/platform/osx/app/LocationCoordinate2DTransformer.m b/platform/osx/app/LocationCoordinate2DTransformer.m index d9c35b2a1f8..aeede234976 100644 --- a/platform/osx/app/LocationCoordinate2DTransformer.m +++ b/platform/osx/app/LocationCoordinate2DTransformer.m @@ -1,26 +1,11 @@ #import "LocationCoordinate2DTransformer.h" -#import "NSValue+Additions.h" +#import -NSString *StringFromDegrees(CLLocationDegrees degrees, char positiveDirection, char negativeDirection) { - double minutes = (degrees - floor(degrees)) * 60; - double seconds = (minutes - floor(minutes)) * 60; - - NSMutableString *string = [NSMutableString stringWithFormat:@"%.0f°", fabs(degrees)]; - if (floor(minutes) || floor(seconds)) { - [string appendFormat:@"%.0f′", minutes]; - } - if (floor(seconds)) { - [string appendFormat:@"%.0f″", seconds]; - } - if (degrees) { - [string appendFormat:@"%c", degrees > 0 ? positiveDirection : negativeDirection]; - } - return string; +@implementation LocationCoordinate2DTransformer { + MGLCoordinateFormatter *_coordinateFormatter; } -@implementation LocationCoordinate2DTransformer - + (Class)transformedValueClass { return [NSString class]; } @@ -29,14 +14,18 @@ + (BOOL)allowsReverseTransformation { return NO; } +- (instancetype)init { + if (self = [super init]) { + _coordinateFormatter = [[MGLCoordinateFormatter alloc] init]; + } + return self; +} + - (id)transformedValue:(id)value { if (![value isKindOfClass:[NSValue class]]) { return nil; } - CLLocationCoordinate2D coordinate = [value CLLocationCoordinate2DValue]; - return [NSString stringWithFormat:@"%@, %@", - StringFromDegrees(coordinate.latitude, 'N', 'S'), - StringFromDegrees(coordinate.longitude, 'E', 'W')]; + return [_coordinateFormatter stringForObjectValue:value]; } @end diff --git a/platform/osx/app/MapDocument.m b/platform/osx/app/MapDocument.m index aaa04e99147..2a537772b55 100644 --- a/platform/osx/app/MapDocument.m +++ b/platform/osx/app/MapDocument.m @@ -2,7 +2,6 @@ #import "AppDelegate.h" #import "DroppedPinAnnotation.h" -#import "NSValue+Additions.h" #import @@ -222,7 +221,7 @@ - (void)applyPendingState { // Temporarily set the display name to the default center coordinate instead // of “Untitled” until the binding kicks in. - NSValue *coordinateValue = [NSValue valueWithCLLocationCoordinate2D:self.mapView.centerCoordinate]; + NSValue *coordinateValue = [NSValue valueWithMGLCoordinate:self.mapView.centerCoordinate]; self.displayName = [[NSValueTransformer valueTransformerForName:@"LocationCoordinate2DTransformer"] transformedValue:coordinateValue]; } diff --git a/platform/osx/app/NSValue+Additions.h b/platform/osx/app/NSValue+Additions.h deleted file mode 100644 index 050dbc81328..00000000000 --- a/platform/osx/app/NSValue+Additions.h +++ /dev/null @@ -1,10 +0,0 @@ -#import -#import - -@interface NSValue (Additions) - -+ (instancetype)valueWithCLLocationCoordinate2D:(CLLocationCoordinate2D)coordinate; - -@property (readonly) CLLocationCoordinate2D CLLocationCoordinate2DValue; - -@end diff --git a/platform/osx/app/NSValue+Additions.m b/platform/osx/app/NSValue+Additions.m deleted file mode 100644 index c060602f43e..00000000000 --- a/platform/osx/app/NSValue+Additions.m +++ /dev/null @@ -1,15 +0,0 @@ -#import "NSValue+Additions.h" - -@implementation NSValue (Additions) - -+ (instancetype)valueWithCLLocationCoordinate2D:(CLLocationCoordinate2D)coordinate { - return [self valueWithBytes:&coordinate objCType:@encode(CLLocationCoordinate2D)]; -} - -- (CLLocationCoordinate2D)CLLocationCoordinate2DValue { - CLLocationCoordinate2D coordinate; - [self getValue:&coordinate]; - return coordinate; -} - -@end diff --git a/platform/osx/app/TimeIntervalTransformer.m b/platform/osx/app/TimeIntervalTransformer.m index e6d7333d255..39177dc5bc6 100644 --- a/platform/osx/app/TimeIntervalTransformer.m +++ b/platform/osx/app/TimeIntervalTransformer.m @@ -1,7 +1,5 @@ #import "TimeIntervalTransformer.h" -#import "NSValue+Additions.h" - @implementation TimeIntervalTransformer + (Class)transformedValueClass { diff --git a/platform/osx/osx.xcodeproj/project.pbxproj b/platform/osx/osx.xcodeproj/project.pbxproj index 4854858df8c..456625f5742 100644 --- a/platform/osx/osx.xcodeproj/project.pbxproj +++ b/platform/osx/osx.xcodeproj/project.pbxproj @@ -8,6 +8,17 @@ /* Begin PBXBuildFile section */ 52BECB0A1CC5A26F009CD791 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */; }; + DA35A2A41CC9EB1A00E826B2 /* MGLCoordinateFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2A61CC9EB2700E826B2 /* MGLCoordinateFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */; }; + DA35A2A81CC9F41600E826B2 /* MGLCoordinateFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */; }; + DA35A2AD1CCA091800E826B2 /* MGLCompassDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2AB1CCA091800E826B2 /* MGLCompassDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2AE1CCA091800E826B2 /* MGLCompassDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2AC1CCA091800E826B2 /* MGLCompassDirectionFormatter.m */; }; + DA35A2B61CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2B51CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m */; }; + DA35A2BF1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2BD1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2C01CCA9B1A00E826B2 /* MGLClockDirectionFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2BE1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.m */; }; + DA35A2C21CCA9F4A00E826B2 /* MGLClockDirectionFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C11CCA9F4A00E826B2 /* MGLClockDirectionFormatterTests.m */; }; + DA35A2CF1CCAAED300E826B2 /* NSValue+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA35A2CD1CCAAED300E826B2 /* NSValue+MGLAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DA35A2D01CCAAED300E826B2 /* NSValue+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2CE1CCAAED300E826B2 /* NSValue+MGLAdditions.m */; }; DA839E971CC2E3400062CAFB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DA839E961CC2E3400062CAFB /* AppDelegate.m */; }; DA839E9A1CC2E3400062CAFB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DA839E991CC2E3400062CAFB /* main.m */; }; DA839E9D1CC2E3400062CAFB /* MapDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = DA839E9C1CC2E3400062CAFB /* MapDocument.m */; }; @@ -18,7 +29,6 @@ DAE6C2E21CC304F900DB3429 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = DAE6C2E11CC304F900DB3429 /* Credits.rtf */; }; DAE6C2ED1CC3050F00DB3429 /* DroppedPinAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2E41CC3050F00DB3429 /* DroppedPinAnnotation.m */; }; DAE6C2EE1CC3050F00DB3429 /* LocationCoordinate2DTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2E61CC3050F00DB3429 /* LocationCoordinate2DTransformer.m */; }; - DAE6C2EF1CC3050F00DB3429 /* NSValue+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2E81CC3050F00DB3429 /* NSValue+Additions.m */; }; DAE6C2F01CC3050F00DB3429 /* OfflinePackNameValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2EA1CC3050F00DB3429 /* OfflinePackNameValueTransformer.m */; }; DAE6C2F11CC3050F00DB3429 /* TimeIntervalTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = DAE6C2EC1CC3050F00DB3429 /* TimeIntervalTransformer.m */; }; DAE6C3321CC30DB200DB3429 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAE6C3281CC30DB200DB3429 /* Mapbox.framework */; }; @@ -134,6 +144,17 @@ /* Begin PBXFileReference section */ 52BECB091CC5A26F009CD791 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCoordinateFormatter.h; path = include/MGLCoordinateFormatter.h; sourceTree = ""; }; + DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatter.m; path = src/MGLCoordinateFormatter.m; sourceTree = ""; }; + DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCoordinateFormatterTests.m; path = ../../darwin/test/MGLCoordinateFormatterTests.m; sourceTree = ""; }; + DA35A2AB1CCA091800E826B2 /* MGLCompassDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLCompassDirectionFormatter.h; path = include/MGLCompassDirectionFormatter.h; sourceTree = ""; }; + DA35A2AC1CCA091800E826B2 /* MGLCompassDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompassDirectionFormatter.m; path = src/MGLCompassDirectionFormatter.m; sourceTree = ""; }; + DA35A2B51CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLCompassDirectionFormatterTests.m; path = ../../darwin/test/MGLCompassDirectionFormatterTests.m; sourceTree = ""; }; + DA35A2BD1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLClockDirectionFormatter.h; path = include/MGLClockDirectionFormatter.h; sourceTree = ""; }; + DA35A2BE1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLClockDirectionFormatter.m; path = src/MGLClockDirectionFormatter.m; sourceTree = ""; }; + DA35A2C11CCA9F4A00E826B2 /* MGLClockDirectionFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLClockDirectionFormatterTests.m; path = ../../darwin/test/MGLClockDirectionFormatterTests.m; sourceTree = ""; }; + DA35A2CD1CCAAED300E826B2 /* NSValue+MGLAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSValue+MGLAdditions.h"; path = "include/NSValue+MGLAdditions.h"; sourceTree = ""; }; + DA35A2CE1CCAAED300E826B2 /* NSValue+MGLAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSValue+MGLAdditions.m"; path = "src/NSValue+MGLAdditions.m"; sourceTree = ""; }; DA839E921CC2E3400062CAFB /* Mapbox GL.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mapbox GL.app"; sourceTree = BUILT_PRODUCTS_DIR; }; DA839E951CC2E3400062CAFB /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; DA839E961CC2E3400062CAFB /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; @@ -150,8 +171,6 @@ DAE6C2E41CC3050F00DB3429 /* DroppedPinAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DroppedPinAnnotation.m; sourceTree = ""; }; DAE6C2E51CC3050F00DB3429 /* LocationCoordinate2DTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationCoordinate2DTransformer.h; sourceTree = ""; }; DAE6C2E61CC3050F00DB3429 /* LocationCoordinate2DTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationCoordinate2DTransformer.m; sourceTree = ""; }; - DAE6C2E71CC3050F00DB3429 /* NSValue+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSValue+Additions.h"; sourceTree = ""; }; - DAE6C2E81CC3050F00DB3429 /* NSValue+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSValue+Additions.m"; sourceTree = ""; }; DAE6C2E91CC3050F00DB3429 /* OfflinePackNameValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OfflinePackNameValueTransformer.h; sourceTree = ""; }; DAE6C2EA1CC3050F00DB3429 /* OfflinePackNameValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OfflinePackNameValueTransformer.m; sourceTree = ""; }; DAE6C2EB1CC3050F00DB3429 /* TimeIntervalTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeIntervalTransformer.h; sourceTree = ""; }; @@ -222,7 +241,7 @@ DAE6C3BC1CC31F2E00DB3429 /* mapbox.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = mapbox.pdf; path = src/resources/mapbox.pdf; sourceTree = SOURCE_ROOT; }; DAE6C3BD1CC31F2E00DB3429 /* MGLAnnotationCallout.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MGLAnnotationCallout.xib; path = src/resources/MGLAnnotationCallout.xib; sourceTree = SOURCE_ROOT; }; DAE6C3C11CC31F4500DB3429 /* Mapbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mapbox.h; sourceTree = ""; }; - DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = "../../build/osx/mbgl.xcconfig"; sourceTree = ""; }; + DAE6C3C51CC31F9100DB3429 /* mbgl.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = mbgl.xcconfig; path = ../../build/osx/mbgl.xcconfig; sourceTree = ""; }; DAE6C3C61CC3499100DB3429 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLGeometryTests.mm; path = ../../darwin/test/MGLGeometryTests.mm; sourceTree = ""; }; DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLOfflinePackTests.m; path = ../../darwin/test/MGLOfflinePackTests.m; sourceTree = ""; }; @@ -297,8 +316,6 @@ DA839E9B1CC2E3400062CAFB /* MapDocument.h */, DA839E9C1CC2E3400062CAFB /* MapDocument.m */, DA839E9E1CC2E3400062CAFB /* MapDocument.xib */, - DAE6C2E71CC3050F00DB3429 /* NSValue+Additions.h */, - DAE6C2E81CC3050F00DB3429 /* NSValue+Additions.m */, DAE6C2E91CC3050F00DB3429 /* OfflinePackNameValueTransformer.h */, DAE6C2EA1CC3050F00DB3429 /* OfflinePackNameValueTransformer.m */, DAE6C2EB1CC3050F00DB3429 /* TimeIntervalTransformer.h */, @@ -350,6 +367,9 @@ DAE6C3371CC30DB200DB3429 /* SDK Tests */ = { isa = PBXGroup; children = ( + DA35A2C11CCA9F4A00E826B2 /* MGLClockDirectionFormatterTests.m */, + DA35A2B51CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m */, + DA35A2A71CC9F41600E826B2 /* MGLCoordinateFormatterTests.m */, DAE6C3C81CC34BD800DB3429 /* MGLGeometryTests.mm */, DAE6C3C91CC34BD800DB3429 /* MGLOfflinePackTests.m */, DAE6C3CA1CC34BD800DB3429 /* MGLOfflineRegionTests.m */, @@ -368,6 +388,12 @@ DAE6C36A1CC31E2A00DB3429 /* MGLAccountManager_Private.h */, DAE6C36B1CC31E2A00DB3429 /* MGLAccountManager.m */, DAE6C34B1CC31E0400DB3429 /* MGLAnnotation.h */, + DA35A2BD1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.h */, + DA35A2BE1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.m */, + DA35A2AB1CCA091800E826B2 /* MGLCompassDirectionFormatter.h */, + DA35A2AC1CCA091800E826B2 /* MGLCompassDirectionFormatter.m */, + DA35A2A31CC9EB1A00E826B2 /* MGLCoordinateFormatter.h */, + DA35A2A51CC9EB2700E826B2 /* MGLCoordinateFormatter.m */, DAE6C34C1CC31E0400DB3429 /* MGLGeometry.h */, DAE6C36C1CC31E2A00DB3429 /* MGLGeometry_Private.h */, DAE6C36D1CC31E2A00DB3429 /* MGLGeometry.mm */, @@ -406,6 +432,8 @@ DAE6C3811CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m */, DAE6C3821CC31E2A00DB3429 /* NSString+MGLAdditions.h */, DAE6C3831CC31E2A00DB3429 /* NSString+MGLAdditions.m */, + DA35A2CD1CCAAED300E826B2 /* NSValue+MGLAdditions.h */, + DA35A2CE1CCAAED300E826B2 /* NSValue+MGLAdditions.m */, ); name = Foundation; path = ../../darwin; @@ -475,12 +503,15 @@ DAE6C3661CC31E0400DB3429 /* MGLShape.h in Headers */, DAE6C3C21CC31F4500DB3429 /* Mapbox.h in Headers */, DAE6C3641CC31E0400DB3429 /* MGLPolygon.h in Headers */, + DA35A2BF1CCA9B1A00E826B2 /* MGLClockDirectionFormatter.h in Headers */, + DA35A2A41CC9EB1A00E826B2 /* MGLCoordinateFormatter.h in Headers */, DAE6C3621CC31E0400DB3429 /* MGLOverlay.h in Headers */, DAE6C3651CC31E0400DB3429 /* MGLPolyline.h in Headers */, DAE6C39A1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.h in Headers */, DAE6C38E1CC31E2A00DB3429 /* MGLOfflineStorage_Private.h in Headers */, DAE6C3601CC31E0400DB3429 /* MGLOfflineRegion.h in Headers */, DAE6C3681CC31E0400DB3429 /* MGLTilePyramidOfflineRegion.h in Headers */, + DA35A2CF1CCAAED300E826B2 /* NSValue+MGLAdditions.h in Headers */, DAE6C3A61CC31E9400DB3429 /* MGLMapViewDelegate.h in Headers */, DAE6C38B1CC31E2A00DB3429 /* MGLOfflinePack_Private.h in Headers */, DAE6C35C1CC31E0400DB3429 /* MGLGeometry.h in Headers */, @@ -490,6 +521,7 @@ DAE6C3B91CC31EF300DB3429 /* MGLOpenGLLayer.h in Headers */, DAE6C3891CC31E2A00DB3429 /* MGLMultiPoint_Private.h in Headers */, DAE6C3A51CC31E9400DB3429 /* MGLMapView+IBAdditions.h in Headers */, + DA35A2AD1CCA091800E826B2 /* MGLCompassDirectionFormatter.h in Headers */, DAE6C3671CC31E0400DB3429 /* MGLStyle.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -635,7 +667,6 @@ DAE6C2EE1CC3050F00DB3429 /* LocationCoordinate2DTransformer.m in Sources */, DAE6C2F11CC3050F00DB3429 /* TimeIntervalTransformer.m in Sources */, DA839E9A1CC2E3400062CAFB /* main.m in Sources */, - DAE6C2EF1CC3050F00DB3429 /* NSValue+Additions.m in Sources */, DA839E971CC2E3400062CAFB /* AppDelegate.m in Sources */, DAE6C2F01CC3050F00DB3429 /* OfflinePackNameValueTransformer.m in Sources */, ); @@ -656,9 +687,12 @@ DAE6C3941CC31E2A00DB3429 /* MGLStyle.mm in Sources */, DAE6C3871CC31E2A00DB3429 /* MGLGeometry.mm in Sources */, DAE6C3B81CC31EF300DB3429 /* MGLMapView+IBAdditions.m in Sources */, + DA35A2D01CCAAED300E826B2 /* NSValue+MGLAdditions.m in Sources */, + DA35A2C01CCA9B1A00E826B2 /* MGLClockDirectionFormatter.m in Sources */, DAE6C3BA1CC31EF300DB3429 /* MGLOpenGLLayer.mm in Sources */, DAE6C38A1CC31E2A00DB3429 /* MGLMultiPoint.mm in Sources */, DAE6C3961CC31E2A00DB3429 /* MGLTypes.m in Sources */, + DA35A2A61CC9EB2700E826B2 /* MGLCoordinateFormatter.m in Sources */, DAE6C3881CC31E2A00DB3429 /* MGLMapCamera.mm in Sources */, DAE6C3911CC31E2A00DB3429 /* MGLPolygon.mm in Sources */, DAE6C39B1CC31E2A00DB3429 /* NSProcessInfo+MGLAdditions.m in Sources */, @@ -667,6 +701,7 @@ DAE6C3851CC31E2A00DB3429 /* MGLAccountManager.m in Sources */, DAE6C3921CC31E2A00DB3429 /* MGLPolyline.mm in Sources */, DAE6C3B51CC31EF300DB3429 /* MGLCompassCell.m in Sources */, + DA35A2AE1CCA091800E826B2 /* MGLCompassDirectionFormatter.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -674,11 +709,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + DA35A2C21CCA9F4A00E826B2 /* MGLClockDirectionFormatterTests.m in Sources */, DAE6C3D41CC34C9900DB3429 /* MGLOfflineRegionTests.m in Sources */, DAE6C3D61CC34C9900DB3429 /* MGLStyleTests.mm in Sources */, + DA35A2B61CCA14D700E826B2 /* MGLCompassDirectionFormatterTests.m in Sources */, DAE6C3D21CC34C9900DB3429 /* MGLGeometryTests.mm in Sources */, DAE6C3D51CC34C9900DB3429 /* MGLOfflineStorageTests.m in Sources */, DAE6C3D31CC34C9900DB3429 /* MGLOfflinePackTests.m in Sources */, + DA35A2A81CC9F41600E826B2 /* MGLCoordinateFormatterTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/platform/osx/sdk/Mapbox.h b/platform/osx/sdk/Mapbox.h index 4a2cd32504d..14d84e2e322 100644 --- a/platform/osx/sdk/Mapbox.h +++ b/platform/osx/sdk/Mapbox.h @@ -9,6 +9,9 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; #import #import #import +#import +#import +#import #import #import #import @@ -26,3 +29,4 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; #import #import #import +#import