diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-01-26 18:52:44 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-01-27 11:44:16 +0100 |
commit | 62ea1f21858c69f6921c775ba7a3de201f0514d8 (patch) | |
tree | 7a4da88706e8a5513e1e13e993b2acc212cae3b1 /platform/macos/app | |
parent | a662508ddde4043ece36d8ea9b424368891d892c (diff) | |
download | qtlocation-mapboxgl-62ea1f21858c69f6921c775ba7a3de201f0514d8.tar.gz |
[core] remove trailing whitespace, add trailing newlines, add space after //
Diffstat (limited to 'platform/macos/app')
-rw-r--r-- | platform/macos/app/AppDelegate.m | 28 | ||||
-rw-r--r-- | platform/macos/app/DroppedPinAnnotation.m | 2 | ||||
-rw-r--r-- | platform/macos/app/LimeGreenStyleLayer.m | 8 | ||||
-rw-r--r-- | platform/macos/app/MGLVectorSource+MBXAdditions.m | 2 | ||||
-rw-r--r-- | platform/macos/app/MapDocument.m | 80 | ||||
-rw-r--r-- | platform/macos/app/OfflinePackNameValueTransformer.m | 4 | ||||
-rw-r--r-- | platform/macos/app/StyleLayerIconTransformer.m | 2 | ||||
-rw-r--r-- | platform/macos/app/TimeIntervalTransformer.m | 6 |
8 files changed, 66 insertions, 66 deletions
diff --git a/platform/macos/app/AppDelegate.m b/platform/macos/app/AppDelegate.m index 44f87092c9..5b848cc79b 100644 --- a/platform/macos/app/AppDelegate.m +++ b/platform/macos/app/AppDelegate.m @@ -20,10 +20,10 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; switch (self.state) { case MGLOfflinePackStateComplete: return [NSImage imageNamed:@"NSMenuOnStateTemplate"]; - + case MGLOfflinePackStateActive: return [NSImage imageNamed:@"NSFollowLinkFreestandingTemplate"]; - + default: return nil; } @@ -104,7 +104,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; - + if (![[NSUserDefaults standardUserDefaults] boolForKey:@"NSQuitAlwaysKeepsWindows"]) { NSData *cameraData = [[NSUserDefaults standardUserDefaults] objectForKey:MGLLastMapCameraDefaultsKey]; if (cameraData) { @@ -130,7 +130,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; [alert runModal]; [self showPreferences:nil]; } - + [self.offlinePacksArrayController bind:@"content" toObject:[MGLOfflineStorage sharedOfflineStorage] withKeyPath:@"packs" options:nil]; } @@ -148,7 +148,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; [[NSUserDefaults standardUserDefaults] setInteger:mapView.debugMask forKey:MGLLastMapDebugMaskDefaultsKey]; } } - + [self.offlinePacksArrayController unbind:@"content"]; } @@ -164,16 +164,16 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; params[parts[0]] = [parts[1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } } - + MGLMapCamera *camera = [MGLMapCamera camera]; NSString *zoomLevelString = params[@"zoom"]; self.pendingZoomLevel = zoomLevelString.length ? zoomLevelString.doubleValue : -1; - + NSString *directionString = params[@"bearing"]; if (directionString.length) { camera.heading = directionString.doubleValue; } - + NSString *centerString = params[@"center"]; if (centerString) { NSArray *coordinateValues = [centerString componentsSeparatedByString:@","]; @@ -182,12 +182,12 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; [coordinateValues[1] doubleValue]); } } - + NSString *pitchString = params[@"pitch"]; if (pitchString.length) { camera.pitch = pitchString.doubleValue; } - + self.pendingCamera = camera; [[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:NULL]; } @@ -196,7 +196,7 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; - (IBAction)showOfflinePacksPanel:(id)sender { [self.offlinePacksPanel makeKeyAndOrderFront:sender]; - + for (MGLOfflinePack *pack in self.offlinePacksArrayController.arrangedObjects) { [pack requestProgress]; } @@ -226,15 +226,15 @@ NSString * const MGLLastMapDebugMaskDefaultsKey = @"MGLLastMapDebugMask"; } break; } - + case MGLOfflinePackStateInactive: [pack resume]; break; - + case MGLOfflinePackStateActive: [pack suspend]; break; - + default: break; } diff --git a/platform/macos/app/DroppedPinAnnotation.m b/platform/macos/app/DroppedPinAnnotation.m index 5b19fd7401..d7bd4068dc 100644 --- a/platform/macos/app/DroppedPinAnnotation.m +++ b/platform/macos/app/DroppedPinAnnotation.m @@ -11,7 +11,7 @@ static MGLCoordinateFormatter *DroppedPinCoordinateFormatter; NSTimer *_timer; NSTimeInterval _priorShownTimeInterval; NSDate *_dateShown; - + NSValueTransformer *_timeIntervalTransformer; } diff --git a/platform/macos/app/LimeGreenStyleLayer.m b/platform/macos/app/LimeGreenStyleLayer.m index 0d2e642db9..40c336cd98 100644 --- a/platform/macos/app/LimeGreenStyleLayer.m +++ b/platform/macos/app/LimeGreenStyleLayer.m @@ -14,11 +14,11 @@ - (void)didMoveToMapView:(MGLMapView *)mapView { static const GLchar *vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }"; static const GLchar *fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 1, 0, 1); }"; - + _program = glCreateProgram(); _vertexShader = glCreateShader(GL_VERTEX_SHADER); _fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); - + glShaderSource(_vertexShader, 1, &vertexShaderSource, NULL); glCompileShader(_vertexShader); glAttachShader(_program, _vertexShader); @@ -27,7 +27,7 @@ glAttachShader(_program, _fragmentShader); glLinkProgram(_program); _aPos = glGetAttribLocation(_program, "a_pos"); - + GLfloat background[] = { -1,-1, 1,-1, -1,1, 1,1 }; glGenBuffers(1, &_buffer); glBindBuffer(GL_ARRAY_BUFFER, _buffer); @@ -48,7 +48,7 @@ if (!_program) { return; } - + glDeleteBuffers(1, &_buffer); glDetachShader(_program, _vertexShader); glDetachShader(_program, _fragmentShader); diff --git a/platform/macos/app/MGLVectorSource+MBXAdditions.m b/platform/macos/app/MGLVectorSource+MBXAdditions.m index f59b72aa9f..644b43a651 100644 --- a/platform/macos/app/MGLVectorSource+MBXAdditions.m +++ b/platform/macos/app/MGLVectorSource+MBXAdditions.m @@ -35,7 +35,7 @@ if (!self.mapboxStreets) { return @{}; } - + // Replace {name} and {name_*} with the matching localized name tag. NSString *localizedKey = preferredLanguage ? [NSString stringWithFormat:@"name_%@", preferredLanguage] : @"name"; NSMutableDictionary *localizedKeysByKey = [NSMutableDictionary dictionaryWithObject:localizedKey forKey:@"name"]; diff --git a/platform/macos/app/MapDocument.m b/platform/macos/app/MapDocument.m index 40fd9e4600..225bb4d3af 100644 --- a/platform/macos/app/MapDocument.m +++ b/platform/macos/app/MapDocument.m @@ -40,7 +40,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } else if ([shape isKindOfClass:[MGLShapeCollection class]]) { subshapes = MBXFlattenedShapes([(MGLShapeCollection *)shape shapes]); } - + if (subshapes) { [flattenedShapes addObjectsFromArray:subshapes]; } else { @@ -63,11 +63,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio /// Style URL inherited from an existing document at the time this document /// was created. NSURL *_inheritedStyleURL; - + NSPoint _mouseLocationForMapViewContextMenu; NSUInteger _droppedPinCounter; NSNumberFormatter *_spellOutNumberFormatter; - + BOOL _isLocalizingLabels; BOOL _showsToolTipsOnDroppedPins; BOOL _randomizesCursorsOnDroppedPins; @@ -95,19 +95,19 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio - (void)windowControllerDidLoadNib:(NSWindowController *)controller { [super windowControllerDidLoadNib:controller]; - + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil]; - + _spellOutNumberFormatter = [[NSNumberFormatter alloc] init]; - + NSPressGestureRecognizer *pressGestureRecognizer = [[NSPressGestureRecognizer alloc] initWithTarget:self action:@selector(handlePressGesture:)]; [self.mapView addGestureRecognizer:pressGestureRecognizer]; - + [self.splitView setPosition:0 ofDividerAtIndex:0]; - + [self applyPendingState]; } @@ -263,7 +263,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(MapDocument * _Nonnull target) { [target toggleStyleLayersAtArrangedObjectIndexes:indices]; }]; - + if (!self.undoManager.undoing) { NSString *actionName; if (indices.count == 1) { @@ -276,11 +276,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager setActionIsDiscardable:YES]; [self.undoManager setActionName:actionName]; } - + for (MGLStyleLayer *layer in layers) { layer.visible = !isVisible; } - + NSIndexSet *columnIndices = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 2)]; [self.styleLayersTableView reloadDataForRowIndexes:indices columnIndexes:columnIndices]; } @@ -298,7 +298,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self deleteStyleLayersAtArrangedObjectIndexes:indices]; }]; - + if (!self.undoManager.undoing) { NSString *actionName; if (indices.count == 1) { @@ -309,7 +309,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } [self.undoManager setActionName:actionName]; } - + [self.styleLayersArrayController insertObjects:layers atArrangedObjectIndexes:indices]; } @@ -318,7 +318,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self insertStyleLayers:layers atArrangedObjectIndexes:indices]; }]; - + if (!self.undoManager.undoing) { NSString *actionName; if (indices.count == 1) { @@ -329,7 +329,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio } [self.undoManager setActionName:actionName]; } - + [self.styleLayersArrayController removeObjectsAtArrangedObjectIndexes:indices]; } @@ -346,17 +346,17 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (![layer isKindOfClass:[MGLSymbolStyleLayer class]]) { continue; } - + MGLVectorSource *source = (MGLVectorSource *)[style sourceWithIdentifier:layer.sourceIdentifier]; if (![source isKindOfClass:[MGLVectorSource class]] || !source.mapboxStreets) { continue; } - + NSDictionary *localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier]; if (!localizedKeysByKey) { localizedKeysByKey = localizedKeysByKeyBySourceIdentifier[layer.sourceIdentifier] = [source localizedKeysByKeyForPreferredLanguage:preferredLanguage]; } - + NSString *(^stringByLocalizingString)(NSString *) = ^ NSString * (NSString *string) { NSMutableString *localizedString = string.mutableCopy; [localizedKeysByKey enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull localizedKey, BOOL * _Nonnull stop) { @@ -369,7 +369,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio }]; return localizedString; }; - + if ([layer.text isKindOfClass:[MGLStyleConstantValue class]]) { NSString *textField = [(MGLStyleConstantValue<NSString *> *)layer.text rawValue]; layer.text = [MGLStyleValue<NSString *> valueWithRawValue:stringByLocalizingString(textField)]; @@ -391,7 +391,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio self.mapView.styleURL = _inheritedStyleURL; _inheritedStyleURL = nil; } - + AppDelegate *appDelegate = (AppDelegate *)NSApp.delegate; if (appDelegate.pendingStyleURL) { self.mapView.styleURL = appDelegate.pendingStyleURL; @@ -420,7 +420,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio self.mapView.zoomLevel = MIN(appDelegate.pendingMaximumZoomLevel, self.mapView.zoomLevel); appDelegate.pendingMaximumZoomLevel = -1; } - + // Temporarily set the display name to the default center coordinate instead // of “Untitled” until the binding kicks in. NSValue *coordinateValue = [NSValue valueWithMGLCoordinate:self.mapView.centerCoordinate]; @@ -475,7 +475,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio - (IBAction)dropManyPins:(id)sender { [self removeAllAnnotations:sender]; - + NSRect bounds = self.mapView.bounds; NSMutableArray *annotations = [NSMutableArray array]; for (CGFloat x = NSMinX(bounds); x < NSMaxX(bounds); x += arc4random_uniform(50)) { @@ -483,7 +483,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [annotations addObject:[self pinAtPoint:NSMakePoint(x, y)]]; } } - + [NSTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(dropOneOfManyPins:) @@ -518,7 +518,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio - (IBAction)startWorldTour:(id)sender { _isTouringWorld = YES; - + [self removeAllAnnotations:sender]; NSUInteger numberOfAnnotations = sizeof(WorldTourDestinations) / sizeof(WorldTourDestinations[0]); NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:numberOfAnnotations]; @@ -537,7 +537,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio _isTouringWorld = NO; return; } - + [annotations removeObjectAtIndex:0]; MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:nextAnnotation.coordinate fromDistance:0 @@ -612,11 +612,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self removeCustomStyleLayer:sender]; }]; - + if (!self.undoManager.isUndoing) { [self.undoManager setActionName:@"Add Lime Green Layer"]; } - + LimeGreenStyleLayer *layer = [[LimeGreenStyleLayer alloc] initWithIdentifier:@"mbx-custom"]; MGLStyleLayer *houseNumberLayer = [self.mapView.style layerWithIdentifier:@"housenum-label"]; if (houseNumberLayer) { @@ -630,11 +630,11 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio [self.undoManager registerUndoWithTarget:self handler:^(id _Nonnull target) { [self insertCustomStyleLayer:sender]; }]; - + if (!self.undoManager.isUndoing) { [self.undoManager setActionName:@"Delete Lime Green Layer"]; } - + MGLStyleLayer *layer = [self.mapView.style layerWithIdentifier:@"mbx-custom"]; [self.mapView.style removeLayer:layer]; } @@ -657,7 +657,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if ([namePrompt runModal] != NSAlertFirstButtonReturn) { return; } - + id <MGLOfflineRegion> region = [[MGLTilePyramidOfflineRegion alloc] initWithStyleURL:self.mapView.styleURL bounds:self.mapView.visibleCoordinateBounds fromZoomLevel:self.mapView.zoomLevel toZoomLevel:self.mapView.maximumZoomLevel]; NSData *context = [[NSValueTransformer valueTransformerForName:@"OfflinePackNameValueTransformer"] reverseTransformedValue:nameTextField.stringValue]; [[MGLOfflineStorage sharedOfflineStorage] addPackForRegion:region withContext:context completionHandler:^(MGLOfflinePack * _Nullable pack, NSError * _Nullable error) { @@ -687,27 +687,27 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio self.mapView.style.transitionDelay = 1; MGLFillStyleLayer *fillStyleLayer = (MGLFillStyleLayer *)[self.mapView.style layerWithIdentifier:@"water"]; - + MGLStyleValue *colorFunction = [MGLStyleValue<NSColor *> valueWithStops:@{ @0.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor redColor]], @10.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor yellowColor]], @20.0: [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor blackColor]], }]; fillStyleLayer.fillColor = colorFunction; - + NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"]; NSURL *geoJSONURL = [NSURL fileURLWithPath:filePath]; MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"ams" URL:geoJSONURL options:nil]; [self.mapView.style addSource:source]; - + MGLFillStyleLayer *fillLayer = [[MGLFillStyleLayer alloc] initWithIdentifier:@"test" source:source]; fillLayer.fillColor = [MGLStyleValue<NSColor *> valueWithRawValue:[NSColor greenColor]]; fillLayer.predicate = [NSPredicate predicateWithFormat:@"%K == %@", @"type", @"park"]; [self.mapView.style addLayer:fillLayer]; - + NSImage *image = [NSImage imageNamed:NSImageNameIChatTheaterTemplate]; [self.mapView.style setImage:image forName:NSImageNameIChatTheaterTemplate]; - + MGLSource *streetsSource = [self.mapView.style sourceWithIdentifier:@"composite"]; MGLSymbolStyleLayer *theaterLayer = [[MGLSymbolStyleLayer alloc] initWithIdentifier:@"theaters" source:streetsSource]; theaterLayer.sourceLayerIdentifier = @"poi_label"; @@ -740,7 +740,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio title = [feature attributeForKey:@"name_en"] ?: [feature attributeForKey:@"name"]; } } - + DroppedPinAnnotation *annotation = [[DroppedPinAnnotation alloc] init]; annotation.coordinate = [self.mapView convertPoint:point toCoordinateFromView:self.mapView]; annotation.title = title ?: @"Dropped Pin"; @@ -949,7 +949,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (![MGLAccountManager accessToken]) { return NSNotFound; } - + NSArray *styleURLs = @[ [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion], [MGLStyle outdoorsStyleURLWithVersion:MGLStyleDefaultVersion], @@ -965,7 +965,7 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio if (!self.mapView) { return NO; } - + SEL action = toolbarItem.action; if (action == @selector(showShareMenu:)) { [(NSButton *)toolbarItem.view sendActionOn:NSLeftMouseDownMask]; @@ -1003,14 +1003,14 @@ NS_ARRAY_OF(id <MGLAnnotation>) *MBXFlattenedShapes(NS_ARRAY_OF(id <MGLAnnotatio NSImage *browserIcon = [[NSWorkspace sharedWorkspace] iconForFile:browserURL.path]; NSString *browserName = [[NSFileManager defaultManager] displayNameAtPath:browserURL.path]; NSString *browserServiceName = [NSString stringWithFormat:@"Open in %@", browserName]; - + NSSharingService *browserService = [[NSSharingService alloc] initWithTitle:browserServiceName image:browserIcon alternateImage:nil handler:^{ [[NSWorkspace sharedWorkspace] openURL:self.shareURL]; }]; - + NSMutableArray *sharingServices = [proposedServices mutableCopy]; [sharingServices insertObject:browserService atIndex:0]; return sharingServices; diff --git a/platform/macos/app/OfflinePackNameValueTransformer.m b/platform/macos/app/OfflinePackNameValueTransformer.m index 2825e48ed3..d1b3c20ac1 100644 --- a/platform/macos/app/OfflinePackNameValueTransformer.m +++ b/platform/macos/app/OfflinePackNameValueTransformer.m @@ -14,7 +14,7 @@ static NSString * const MBXOfflinePackContextNameKey = @"Name"; - (NSString *)transformedValue:(NSData *)context { NSAssert([context isKindOfClass:[NSData class]], @"Context should be NSData."); - + NSDictionary *userInfo = [NSKeyedUnarchiver unarchiveObjectWithData:context]; NSAssert([userInfo isKindOfClass:[NSDictionary class]], @"Context of offline pack isn’t a dictionary."); NSString *name = userInfo[MBXOfflinePackContextNameKey]; @@ -24,7 +24,7 @@ static NSString * const MBXOfflinePackContextNameKey = @"Name"; - (NSData *)reverseTransformedValue:(NSString *)name { NSAssert([name isKindOfClass:[NSString class]], @"Name should be a string."); - + return [NSKeyedArchiver archivedDataWithRootObject:@{ MBXOfflinePackContextNameKey: name, }]; diff --git a/platform/macos/app/StyleLayerIconTransformer.m b/platform/macos/app/StyleLayerIconTransformer.m index 93f59abb3e..ff2b964b87 100644 --- a/platform/macos/app/StyleLayerIconTransformer.m +++ b/platform/macos/app/StyleLayerIconTransformer.m @@ -31,7 +31,7 @@ if ([layer isKindOfClass:[MGLSymbolStyleLayer class]]) { return [NSImage imageNamed:@"symbol"]; } - + return nil; } diff --git a/platform/macos/app/TimeIntervalTransformer.m b/platform/macos/app/TimeIntervalTransformer.m index 39177dc5bc..2c9cb6fc74 100644 --- a/platform/macos/app/TimeIntervalTransformer.m +++ b/platform/macos/app/TimeIntervalTransformer.m @@ -18,7 +18,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString * if (![value isKindOfClass:[NSValue class]]) { return nil; } - + NSTimeInterval timeInterval = [value doubleValue]; NSInteger seconds = floor(timeInterval); NSInteger minutes = floor(seconds / 60); @@ -29,7 +29,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString * hours -= days * 24; NSInteger weeks = floor(days) / 7; days -= weeks * 7; - + NSMutableArray *components = [NSMutableArray array]; if (seconds || timeInterval < 60) { [components addObject:NumberAndUnitString(seconds, @"second", @"seconds")]; @@ -46,7 +46,7 @@ NSString *NumberAndUnitString(NSInteger quantity, NSString *singular, NSString * if (weeks) { [components insertObject:NumberAndUnitString(weeks, @"week", @"weeks") atIndex:0]; } - + return [components componentsJoinedByString:@", "]; } |