diff --git a/iphone/Maps/Categories/UIView+Highlight.swift b/iphone/Maps/Categories/UIView+Highlight.swift new file mode 100644 index 0000000000..76e5e8976a --- /dev/null +++ b/iphone/Maps/Categories/UIView+Highlight.swift @@ -0,0 +1,25 @@ +extension UIView { + @objc + func highlight() { + let color = UIColor.linkBlueHighlighted().withAlphaComponent(0.2) + let duration: TimeInterval = kDefaultAnimationDuration + let overlayView = UIView(frame: bounds) + overlayView.backgroundColor = color + overlayView.alpha = 0 + overlayView.clipsToBounds = true + overlayView.isUserInteractionEnabled = false + overlayView.layer.cornerRadius = layer.cornerRadius + overlayView.layer.maskedCorners = layer.maskedCorners + addSubview(overlayView) + + UIView.animate(withDuration: duration, delay: duration, options: .curveEaseInOut, animations: { + overlayView.alpha = 1 + }) { _ in + UIView.animate(withDuration: duration, delay: duration * 3, options: .curveEaseInOut, animations: { + overlayView.alpha = 0 + }) { _ in + overlayView.removeFromSuperview() + } + } + } +} diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 0ddb5fa2df..75119c0263 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -470,6 +470,7 @@ CDCA278622451F5000167D87 /* RouteInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDCA278522451F5000167D87 /* RouteInfo.swift */; }; CDCA278E2248F34C00167D87 /* MWMRoutingManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDCA278B2248F34C00167D87 /* MWMRoutingManager.mm */; }; ED0B1C312BC2951F00FB8EDD /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = ED0B1C302BC2951F00FB8EDD /* PrivacyInfo.xcprivacy */; }; + ED0B1FEF2CAA9A25006E31A4 /* UIView+Highlight.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0B1FEE2CAA9A25006E31A4 /* UIView+Highlight.swift */; }; ED0C54992C6E6AF000253A5F /* TrackRecordingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED0C54972C6E14E800253A5F /* TrackRecordingManager.swift */; }; ED1080A72B791CFE0023F27E /* SocialMediaCollectionViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED1080A62B791CFE0023F27E /* SocialMediaCollectionViewHeader.swift */; }; ED1263AB2B6F99F900AD99F3 /* UIView+AddSeparator.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED1263AA2B6F99F900AD99F3 /* UIView+AddSeparator.swift */; }; @@ -1395,6 +1396,7 @@ CDE0F3AD225B8D45008BA5C3 /* MWMSpeedCameraManagerMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMSpeedCameraManagerMode.h; sourceTree = ""; }; ED097E762BB80C320006ED01 /* OMapsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OMapsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; ED0B1C302BC2951F00FB8EDD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + ED0B1FEE2CAA9A25006E31A4 /* UIView+Highlight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Highlight.swift"; sourceTree = ""; }; ED0C54972C6E14E800253A5F /* TrackRecordingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackRecordingManager.swift; sourceTree = ""; }; ED1080A62B791CFE0023F27E /* SocialMediaCollectionViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocialMediaCollectionViewHeader.swift; sourceTree = ""; }; ED1263AA2B6F99F900AD99F3 /* UIView+AddSeparator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+AddSeparator.swift"; sourceTree = ""; }; @@ -2163,6 +2165,7 @@ 99A614E223CDD1D900D8D8D0 /* UIButton+RuntimeAttributes.h */, 99A614E323CDD1D900D8D8D0 /* UIButton+RuntimeAttributes.m */, 34D3B04D1E38A20C004100F9 /* Bundle+Init.swift */, + ED0B1FEE2CAA9A25006E31A4 /* UIView+Highlight.swift */, 3454D79B1E07F045004AF2AD /* CLLocation+Mercator.h */, 3454D79C1E07F045004AF2AD /* CLLocation+Mercator.mm */, 3454D79D1E07F045004AF2AD /* DateComponentsFormatter+ETA.swift */, @@ -4472,6 +4475,7 @@ 1DFA2F6A20D3B57400FB2C66 /* UIColor+PartnerColor.m in Sources */, 9989273B2449E60200260CE2 /* BottomMenuBuilder.swift in Sources */, 993DF10F23F6BDB100AC231A /* UIActivityIndicatorRenderer.swift in Sources */, + ED0B1FEF2CAA9A25006E31A4 /* UIView+Highlight.swift in Sources */, 99A614E423CDD1D900D8D8D0 /* UIButton+RuntimeAttributes.m in Sources */, 343E75981E5B1EE20041226A /* MWMCollectionViewController.m in Sources */, 34E776141F14B17F003040B3 /* AvailableArea.swift in Sources */,