Skip to content

Commit c20552f

Browse files
committed
Updated round corners.
1 parent 4314a64 commit c20552f

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

Example Apps/SparrowKit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,8 @@
334334
Base,
335335
);
336336
mainGroup = F43F827226578D83001D9B3D;
337+
packageReferences = (
338+
);
337339
productRefGroup = F43F827C26578D83001D9B3D /* Products */;
338340
projectDirPath = "";
339341
projectRoot = "";

Sources/SparrowKit/UIKit/Extensions/UIViewExtension.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,13 @@ extension UIView {
317317

318318
- important:
319319
Need call after changed frame. Better leave it in `layoutSubviews` method.
320+
321+
- parameter curve: Style of round curve.
320322
*/
321-
open func roundCorners() {
323+
open func roundCorners(_ curve: CornerCurve = .continuous) {
324+
if #available(iOS 13.0, *) {
325+
layer.cornerCurve = curve.layerCornerCurve
326+
}
322327
layer.cornerRadius = min(frame.width, frame.height) / 2
323328
}
324329

@@ -420,6 +425,21 @@ extension UIView {
420425
self.alpha = 0
421426
}, completion: completion)
422427
}
428+
429+
430+
public enum CornerCurve {
431+
432+
case circle
433+
case continuous
434+
435+
@available(iOS 13.0, *)
436+
var layerCornerCurve: CALayerCornerCurve {
437+
switch self {
438+
case .circle: return .circular
439+
case .continuous: return .continuous
440+
}
441+
}
442+
}
423443
}
424444
#endif
425445

SparrowKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'SparrowKit'
4-
s.version = '3.3.6'
4+
s.version = '3.3.8'
55
s.summary = 'Collection of native Swift extensions to boost your development. Support tvOS and watchOS.'
66
s.homepage = 'https://github.com/ivanvorobei/SparrowKit'
77
s.source = { :git => 'https://github.com/ivanvorobei/SparrowKit.git', :tag => s.version }

0 commit comments

Comments
 (0)