@@ -219,7 +219,7 @@ extension UIView {
219219 if let configuration = configuration {
220220 blurEffectView. layer. borderColor = configuration. backgroundBorderColor
221221 blurEffectView. layer. borderWidth = configuration. backgroundBorderWidth
222- blurEffectView. layer. cornerRadius = configuration. cornerRadius
222+ // blurEffectView.layer.cornerRadius = configuration.cornerRadius
223223 blurEffectView. layer. masksToBounds = true
224224 }
225225 insertSubview ( blurEffectView, at: 0 )
@@ -242,14 +242,14 @@ extension UIView {
242242 locations)
243243
244244 if let viewConfiguration = viewConfiguration {
245- gradientView. gradientLayer? . cornerRadius = viewConfiguration. cornerRadius
245+ // gradientView.gradientLayer?.cornerRadius = viewConfiguration.cornerRadius
246246 gradientView. gradientLayer? . masksToBounds = true
247247 }
248248 insertSubview ( gradientView, at: 0 )
249249 gradientView. fill ( to: self )
250250 }
251251
252- class GradientView : UIView {
252+ final class GradientView : UIView {
253253
254254 let gradientLayer : CAGradientLayer ?
255255
@@ -310,3 +310,45 @@ extension UIView {
310310 self . layer. anchorPoint = anchorPoint
311311 }
312312}
313+
314+ extension UIView {
315+
316+ // MARK: - Apply Round Corners
317+
318+ ///
319+ func applyRoundCorners( _ cornerRadius: CGFloat ) {
320+
321+ applyRoundCorners ( topLeftRadius: cornerRadius,
322+ topRightRadius: cornerRadius,
323+ bottomLeftRadius: cornerRadius,
324+ bottomRightRadius: cornerRadius)
325+ }
326+
327+ ///
328+ func applyRoundCorners( _ cornerRadius: TSAlertController . ViewConfiguration . CornerRadius ) {
329+
330+ applyRoundCorners ( topLeftRadius: cornerRadius. topLeft,
331+ topRightRadius: cornerRadius. topRight,
332+ bottomLeftRadius: cornerRadius. bottomLeft,
333+ bottomRightRadius: cornerRadius. bottomRight)
334+ }
335+
336+ ///
337+ func applyRoundCorners( topLeftRadius: CGFloat ,
338+ topRightRadius: CGFloat ,
339+ bottomLeftRadius: CGFloat ,
340+ bottomRightRadius: CGFloat ) {
341+
342+ let roundedRect = self . bounds
343+
344+ let path = UIBezierPath ( roundedRect: roundedRect,
345+ topLeftRadius: topLeftRadius,
346+ topRightRadius: topRightRadius,
347+ bottomLeftRadius: bottomLeftRadius,
348+ bottomRightRadius: bottomRightRadius)
349+
350+ let shapeLayer = CAShapeLayer ( )
351+ shapeLayer. path = path. cgPath
352+ layer. mask = shapeLayer
353+ }
354+ }
0 commit comments