Co-authored-by: mwilsnd <mwilsnd@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
32 lines
638 B
Objective-C
32 lines
638 B
Objective-C
#import "LocationCoordinate2DTransformer.h"
|
|
|
|
#import <Mapbox.h>
|
|
|
|
@implementation LocationCoordinate2DTransformer {
|
|
MLNCoordinateFormatter *_coordinateFormatter;
|
|
}
|
|
|
|
+ (Class)transformedValueClass {
|
|
return [NSString class];
|
|
}
|
|
|
|
+ (BOOL)allowsReverseTransformation {
|
|
return NO;
|
|
}
|
|
|
|
- (instancetype)init {
|
|
if (self = [super init]) {
|
|
_coordinateFormatter = [[MLNCoordinateFormatter alloc] init];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (id)transformedValue:(id)value {
|
|
if (![value isKindOfClass:[NSValue class]]) {
|
|
return nil;
|
|
}
|
|
return [_coordinateFormatter stringForObjectValue:value].capitalizedString;
|
|
}
|
|
|
|
@end
|