From 77ae4b1e47088e7330712141402e0b3fd09eecee Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Tue, 13 Feb 2024 12:32:58 +0400 Subject: [PATCH] [ios] add CALayer+SetCorner extension Signed-off-by: Kiryl Kaveryn --- iphone/Maps/Categories/CALayer+SetCorner.swift | 13 +++++++++++++ iphone/Maps/Maps.xcodeproj/project.pbxproj | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 iphone/Maps/Categories/CALayer+SetCorner.swift diff --git a/iphone/Maps/Categories/CALayer+SetCorner.swift b/iphone/Maps/Categories/CALayer+SetCorner.swift new file mode 100644 index 0000000000..a28cefbdb8 --- /dev/null +++ b/iphone/Maps/Categories/CALayer+SetCorner.swift @@ -0,0 +1,13 @@ +extension CALayer { + func setCorner(radius: CGFloat, + curve: CALayerCornerCurve? = nil, + corners: CACornerMask? = nil) { + cornerRadius = radius + if let corners { + maskedCorners = corners + } + if #available(iOS 13.0, *) { + cornerCurve = curve ?? .continuous + } + } +} diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 51cf3fc8bd..8a4d4dd426 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -467,6 +467,7 @@ ED3EAC202B03C88100220A4A /* BottomTabBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED3EAC1F2B03C88100220A4A /* BottomTabBarButton.swift */; }; EDBD68072B625724005DD151 /* LocationServicesDisabledAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = EDBD68062B625724005DD151 /* LocationServicesDisabledAlert.xib */; }; EDBD680B2B62572E005DD151 /* LocationServicesDisabledAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDBD680A2B62572E005DD151 /* LocationServicesDisabledAlert.swift */; }; + EDC3573B2B7B5029001AE9CA /* CALayer+SetCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDC3573A2B7B5029001AE9CA /* CALayer+SetCorner.swift */; }; F607C1881C032A8800B53A87 /* resources-hdpi_clear in Resources */ = {isa = PBXBuildFile; fileRef = F607C1831C032A8800B53A87 /* resources-hdpi_clear */; }; F607C18A1C032A8800B53A87 /* resources-hdpi_dark in Resources */ = {isa = PBXBuildFile; fileRef = F607C1841C032A8800B53A87 /* resources-hdpi_dark */; }; F623DA6C1C9C2731006A3436 /* opening_hours_how_to_edit.html in Resources */ = {isa = PBXBuildFile; fileRef = F623DA6A1C9C2731006A3436 /* opening_hours_how_to_edit.html */; }; @@ -1335,6 +1336,7 @@ ED48BBB917C2B1E2003E7E92 /* CircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CircleView.m; sourceTree = ""; }; EDBD68062B625724005DD151 /* LocationServicesDisabledAlert.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LocationServicesDisabledAlert.xib; sourceTree = ""; }; EDBD680A2B62572E005DD151 /* LocationServicesDisabledAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationServicesDisabledAlert.swift; sourceTree = ""; }; + EDC3573A2B7B5029001AE9CA /* CALayer+SetCorner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CALayer+SetCorner.swift"; sourceTree = ""; }; EE026F0511D6AC0D00645242 /* classificator.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = classificator.txt; path = ../../data/classificator.txt; sourceTree = SOURCE_ROOT; }; EE164810135CEE49003B8A3E /* 06_code2000.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = 06_code2000.ttf; path = ../../data/06_code2000.ttf; sourceTree = SOURCE_ROOT; }; EE583CBA12F773F00042CBE3 /* unicode_blocks.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = unicode_blocks.txt; path = ../../data/unicode_blocks.txt; sourceTree = ""; }; @@ -2094,6 +2096,7 @@ 99E2B0112368A8C700FFABC5 /* MWMCategory+PlacesCountTitle.swift */, 9957FAE0237AE04900855F48 /* MWMMapViewControlsManager+AddPlace.h */, 471A7BB7247FE3C300A0D4C1 /* URL+Query.swift */, + EDC3573A2B7B5029001AE9CA /* CALayer+SetCorner.swift */, ); path = Categories; sourceTree = ""; @@ -4233,6 +4236,7 @@ 99012851244732DB00C72B10 /* BottomTabBarViewController.swift in Sources */, F63AF5061EA6162400A1DB98 /* FilterTypeCell.swift in Sources */, 993DF10623F6BDB100AC231A /* UIColor+rgba.swift in Sources */, + EDC3573B2B7B5029001AE9CA /* CALayer+SetCorner.swift in Sources */, 47E3C7332111F4D8008B3B27 /* CoverVerticalDismissalAnimator.swift in Sources */, 471AB99423ABA3BD00F56D49 /* SearchMapsDataSource.swift in Sources */, 47CA68F1250B54AF00671019 /* BookmarkCell.swift in Sources */,