diff options
Diffstat (limited to 'platform/ios')
26 files changed, 85 insertions, 73 deletions
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index be0c2388f5..c1b0b875a2 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -3749,6 +3749,8 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -4094,6 +4096,8 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -4106,6 +4110,8 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = NO; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = "$(SRCROOT)/app/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/platform/ios/resources/Base.lproj/Localizable.strings b/platform/ios/resources/Base.lproj/Localizable.strings index d660cb6ddd..e1bfc0b256 100644 --- a/platform/ios/resources/Base.lproj/Localizable.strings +++ b/platform/ios/resources/Base.lproj/Localizable.strings @@ -1,7 +1,7 @@ /* Accessibility hint */ "ANNOTATION_A11Y_HINT" = "Shows more info"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Cancel"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ @@ -20,7 +20,7 @@ "DESIGNABLE" = "To display a Mapbox-hosted map here, set %1$@ to your access token in %2$@\n\nFor detailed instructions, see:"; /* Setup documentation URL display string; keep as short as possible */ -"FIRST_STEPS_URL" = "mapbox.com/help/first-steps-ios-sdk"; +"FIRST_STEPS_URL" = "docs.mapbox.com/help/tutorials/first-steps-ios-sdk"; /* Accessibility hint */ "INFO_A11Y_HINT" = "Shows credits, a feedback form, and more"; diff --git a/platform/ios/resources/bg.lproj/Localizable.strings b/platform/ios/resources/bg.lproj/Localizable.strings index 777f4fe563..9b77111d30 100644 --- a/platform/ios/resources/bg.lproj/Localizable.strings +++ b/platform/ios/resources/bg.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Статус код %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Отказ"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/ca.lproj/Localizable.strings b/platform/ios/resources/ca.lproj/Localizable.strings index a5c06f739e..41996b191f 100644 --- a/platform/ios/resources/ca.lproj/Localizable.strings +++ b/platform/ios/resources/ca.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "El codi d’estat era %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Cancel·lar"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/cs.lproj/Localizable.strings b/platform/ios/resources/cs.lproj/Localizable.strings index d660cb6ddd..587e67a054 100644 --- a/platform/ios/resources/cs.lproj/Localizable.strings +++ b/platform/ios/resources/cs.lproj/Localizable.strings @@ -1,7 +1,7 @@ /* Accessibility hint */ "ANNOTATION_A11Y_HINT" = "Shows more info"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Cancel"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/da.lproj/Localizable.strings b/platform/ios/resources/da.lproj/Localizable.strings index dd384b21fc..f1af0c39db 100644 --- a/platform/ios/resources/da.lproj/Localizable.strings +++ b/platform/ios/resources/da.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Status koden var %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Fortryd"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/de.lproj/Localizable.strings b/platform/ios/resources/de.lproj/Localizable.strings index f3e5dfe2f1..c340a78770 100644 --- a/platform/ios/resources/de.lproj/Localizable.strings +++ b/platform/ios/resources/de.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Der Statuscode ist %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Abbrechen"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/es.lproj/Localizable.strings b/platform/ios/resources/es.lproj/Localizable.strings index 90811be973..b2da706d8c 100644 --- a/platform/ios/resources/es.lproj/Localizable.strings +++ b/platform/ios/resources/es.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "El código de estado fue %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Cancelar"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/fr.lproj/Localizable.strings b/platform/ios/resources/fr.lproj/Localizable.strings index f75d067251..17a0240517 100644 --- a/platform/ios/resources/fr.lproj/Localizable.strings +++ b/platform/ios/resources/fr.lproj/Localizable.strings @@ -1,7 +1,7 @@ /* Accessibility hint */ "ANNOTATION_A11Y_HINT" = "Afficher plus d’informations"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Annuler"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/gl.lproj/Localizable.strings b/platform/ios/resources/gl.lproj/Localizable.strings index 2ab14fd0b5..083423d434 100644 --- a/platform/ios/resources/gl.lproj/Localizable.strings +++ b/platform/ios/resources/gl.lproj/Localizable.strings @@ -1,7 +1,7 @@ /* Accessibility hint */ "ANNOTATION_A11Y_HINT" = "Amosa máis información"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Desbotar"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/he.lproj/Localizable.strings b/platform/ios/resources/he.lproj/Localizable.strings index 9503c16d3d..2e4c9a17fb 100644 --- a/platform/ios/resources/he.lproj/Localizable.strings +++ b/platform/ios/resources/he.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "סטטוס הקוד היה %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "ביטול"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/hu.lproj/Localizable.strings b/platform/ios/resources/hu.lproj/Localizable.strings index e4c9882600..bac747b4a2 100644 --- a/platform/ios/resources/hu.lproj/Localizable.strings +++ b/platform/ios/resources/hu.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "A státuszkód %ld volt"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Mégse"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/ja.lproj/Localizable.strings b/platform/ios/resources/ja.lproj/Localizable.strings index 0bcb706cae..0b5429b487 100644 --- a/platform/ios/resources/ja.lproj/Localizable.strings +++ b/platform/ios/resources/ja.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "The status code was %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "キャンセル"; /* Accessibility hint */ diff --git a/platform/ios/resources/ko.lproj/Localizable.strings b/platform/ios/resources/ko.lproj/Localizable.strings index 40136803d1..6374fc72df 100644 --- a/platform/ios/resources/ko.lproj/Localizable.strings +++ b/platform/ios/resources/ko.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "상태 코드 %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "취소"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/lt.lproj/Localizable.strings b/platform/ios/resources/lt.lproj/Localizable.strings index e8424434b9..2f2e30f966 100644 --- a/platform/ios/resources/lt.lproj/Localizable.strings +++ b/platform/ios/resources/lt.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Būklės kodas: %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Atšaukti"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/pt-BR.lproj/Localizable.strings b/platform/ios/resources/pt-BR.lproj/Localizable.strings index 4e7e998ab3..d80c943c7e 100644 --- a/platform/ios/resources/pt-BR.lproj/Localizable.strings +++ b/platform/ios/resources/pt-BR.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "O código de status foi %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Cancelar"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/pt-PT.lproj/Localizable.strings b/platform/ios/resources/pt-PT.lproj/Localizable.strings index bed26df478..8104ef5842 100644 --- a/platform/ios/resources/pt-PT.lproj/Localizable.strings +++ b/platform/ios/resources/pt-PT.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "O código de estado era %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Cancelar"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/ru.lproj/Localizable.strings b/platform/ios/resources/ru.lproj/Localizable.strings index b6ceffd520..5bb987489e 100644 --- a/platform/ios/resources/ru.lproj/Localizable.strings +++ b/platform/ios/resources/ru.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Код ответа %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Отмена"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/sv.lproj/Localizable.strings b/platform/ios/resources/sv.lproj/Localizable.strings index d136f9e52f..db189f141f 100644 --- a/platform/ios/resources/sv.lproj/Localizable.strings +++ b/platform/ios/resources/sv.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Statuskoden var %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Avbryt"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/uk.lproj/Localizable.strings b/platform/ios/resources/uk.lproj/Localizable.strings index 4e5a452b95..f413b963c1 100644 --- a/platform/ios/resources/uk.lproj/Localizable.strings +++ b/platform/ios/resources/uk.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Код стану %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Скасувати"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/vi.lproj/Localizable.strings b/platform/ios/resources/vi.lproj/Localizable.strings index 06242a39e7..0a6d937d2c 100644 --- a/platform/ios/resources/vi.lproj/Localizable.strings +++ b/platform/ios/resources/vi.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "Mã trạng thái là %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "Hủy bỏ"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/zh-Hans.lproj/Localizable.strings b/platform/ios/resources/zh-Hans.lproj/Localizable.strings index 1a3453e209..98d4e345fa 100644 --- a/platform/ios/resources/zh-Hans.lproj/Localizable.strings +++ b/platform/ios/resources/zh-Hans.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "The status code was %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "取消"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/resources/zh-Hant.lproj/Localizable.strings b/platform/ios/resources/zh-Hant.lproj/Localizable.strings index d660a3d1ae..abdee6d3ab 100644 --- a/platform/ios/resources/zh-Hant.lproj/Localizable.strings +++ b/platform/ios/resources/zh-Hant.lproj/Localizable.strings @@ -7,7 +7,7 @@ /* No comment provided by engineer. */ "API_CLIENT_400_REASON" = "The status code was %ld"; -/* No comment provided by engineer. */ +/* Title of button for dismissing attribution action sheet */ "CANCEL" = "取消"; /* Accessibility hint for closing the selected annotation’s callout view and returning to the map */ diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 2423d62ee1..607a197840 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -1130,7 +1130,7 @@ MGL_EXPORT `UIApplicationWillTerminateNotification`; you may receive a `nil` return value depending on the order of notification delivery. */ -- (nullable MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; +- (MGLMapCamera *)cameraThatFitsCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; /** Returns the camera that best fits the given coordinate bounds, with the specified camera, @@ -1150,7 +1150,7 @@ MGL_EXPORT `UIApplicationWillTerminateNotification`; you may receive a `nil` return value depending on the order of notification delivery. */ -- (nullable MGLMapCamera *)camera:(MGLMapCamera *)camera fittingCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; +- (MGLMapCamera *)camera:(MGLMapCamera *)camera fittingCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets; /** Returns the camera that best fits the given shape, with the specified camera, @@ -1169,7 +1169,7 @@ MGL_EXPORT `UIApplicationWillTerminateNotification`; you may receive a `nil` return value depending on the order of notification delivery. */ -- (nullable MGLMapCamera *)camera:(MGLMapCamera *)camera fittingShape:(MGLShape *)shape edgePadding:(UIEdgeInsets)insets; +- (MGLMapCamera *)camera:(MGLMapCamera *)camera fittingShape:(MGLShape *)shape edgePadding:(UIEdgeInsets)insets; /** Returns the camera that best fits the given shape, with the specified direction, @@ -1187,7 +1187,7 @@ MGL_EXPORT `UIApplicationWillTerminateNotification`; you may receive a `nil` return value depending on the order of notification delivery. */ -- (nullable MGLMapCamera *)cameraThatFitsShape:(MGLShape *)shape direction:(CLLocationDirection)direction edgePadding:(UIEdgeInsets)insets; +- (MGLMapCamera *)cameraThatFitsShape:(MGLShape *)shape direction:(CLLocationDirection)direction edgePadding:(UIEdgeInsets)insets; /** Returns the point in this view’s coordinate system on which to "anchor" in diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index b5383ee30e..7cebd57710 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2481,7 +2481,7 @@ public: }]; [attributionController addAction:telemetryAction]; - NSString *cancelTitle = NSLocalizedStringWithDefaultValue(@"CANCEL", nil, nil, @"Cancel", @"Cancel"); + NSString *cancelTitle = NSLocalizedStringWithDefaultValue(@"CANCEL", nil, nil, @"Cancel", @"Title of button for dismissing attribution action sheet"); UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel handler:NULL]; @@ -3873,9 +3873,9 @@ public: { if (!_mbglMap) { - return nil; + return self.residualCamera; } - + mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets); padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInset); mbgl::CameraOptions cameraOptions = self.mbglMap.cameraForLatLngBounds(MGLLatLngBoundsFromCoordinateBounds(bounds), padding); @@ -3886,7 +3886,7 @@ public: { if (!_mbglMap) { - return nil; + return self.residualCamera; } mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets); @@ -3903,7 +3903,7 @@ public: - (MGLMapCamera *)camera:(MGLMapCamera *)camera fittingShape:(MGLShape *)shape edgePadding:(UIEdgeInsets)insets { if (!_mbglMap) { - return nil; + return self.residualCamera; } mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets); @@ -3921,7 +3921,7 @@ public: - (MGLMapCamera *)cameraThatFitsShape:(MGLShape *)shape direction:(CLLocationDirection)direction edgePadding:(UIEdgeInsets)insets { if (!_mbglMap) { - return nil; + return self.residualCamera; } mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets); @@ -3936,7 +3936,7 @@ public: { if (!_mbglMap) { - return nil; + return self.residualCamera; } mbgl::CameraOptions mapCamera = self.mbglMap.getCameraOptions(); diff --git a/platform/ios/vendor/SMCalloutView/SMCalloutView.m b/platform/ios/vendor/SMCalloutView/SMCalloutView.m index 0520ba08a5..06626f9497 100755 --- a/platform/ios/vendor/SMCalloutView/SMCalloutView.m +++ b/platform/ios/vendor/SMCalloutView/SMCalloutView.m @@ -520,52 +520,58 @@ NSTimeInterval const kMGLSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0; - (CAAnimation *)animationWithType:(MGLSMCalloutAnimation)type presenting:(BOOL)presenting { CAAnimation *animation = nil; - if (type == MGLSMCalloutAnimationBounce) { - - CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fade.duration = 0.23; - fade.fromValue = presenting ? @0.0 : @1.0; - fade.toValue = presenting ? @1.0 : @0.0; - fade.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; - - CABasicAnimation *bounce = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; - bounce.duration = 0.23; - bounce.fromValue = presenting ? @0.7 : @1.0; - bounce.toValue = presenting ? @1.0 : @0.7; - bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.59367:0.12066:0.18878:1.5814]; - - CAAnimationGroup *group = [CAAnimationGroup animation]; - group.animations = @[fade, bounce]; - group.duration = 0.23; - - animation = group; - } - else if (type == MGLSMCalloutAnimationFade) { - CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fade.duration = 1.0/3.0; - fade.fromValue = presenting ? @0.0 : @1.0; - fade.toValue = presenting ? @1.0 : @0.0; - animation = fade; - } - else if (type == MGLSMCalloutAnimationStretch) { - CABasicAnimation *stretch = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; - stretch.duration = 0.1; - stretch.fromValue = presenting ? @0.0 : @1.0; - stretch.toValue = presenting ? @1.0 : @0.0; - animation = stretch; + switch (type) + { + case MGLSMCalloutAnimationBounce: + { + CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"]; + fade.duration = 0.23; + fade.fromValue = presenting ? @0.0 : @1.0; + fade.toValue = presenting ? @1.0 : @0.0; + fade.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + + CABasicAnimation *bounce = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + bounce.duration = 0.23; + bounce.fromValue = presenting ? @0.7 : @1.0; + bounce.toValue = presenting ? @1.0 : @0.7; + bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.59367:0.12066:0.18878:1.5814]; + + CAAnimationGroup *group = [CAAnimationGroup animation]; + group.animations = @[fade, bounce]; + group.duration = 0.23; + + animation = group; + break; + } + + case MGLSMCalloutAnimationFade: + { + CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"]; + fade.duration = 1.0/3.0; + fade.fromValue = presenting ? @0.0 : @1.0; + fade.toValue = presenting ? @1.0 : @0.0; + animation = fade; + break; + } + + case MGLSMCalloutAnimationStretch: + { + CABasicAnimation *stretch = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; + stretch.duration = 0.1; + stretch.fromValue = presenting ? @0.0 : @1.0; + stretch.toValue = presenting ? @1.0 : @0.0; + animation = stretch; + break; + } } - - NSAssert(animation, @"There should be an animation"); - + // CAAnimation is KVC compliant, so we can store whether we're presenting for lookup in our delegate methods [animation setValue:@(presenting) forKey:@"presenting"]; animation.fillMode = kCAFillModeForwards; animation.removedOnCompletion = NO; - // Cast as non-null to mute static analysis warning as documented at - // https://clang-analyzer.llvm.org/faq.html#decide_nullability - return (CAAnimation * _Nonnull)animation; + return animation; } - (void)layoutSubviews { |