From 0b4d1790aaf68198b4cad7b09a78b2a90592425b Mon Sep 17 00:00:00 2001 From: Qutaibah Essa Date: Wed, 11 Jan 2023 13:35:10 +0300 Subject: [PATCH 1/2] create get/set functions for cornerRadius --- .../Classes/PopupDialogContainerView.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/PopupDialog/Classes/PopupDialogContainerView.swift b/PopupDialog/Classes/PopupDialogContainerView.swift index 4f36e6c0..e8aa23f6 100644 --- a/PopupDialog/Classes/PopupDialogContainerView.swift +++ b/PopupDialog/Classes/PopupDialogContainerView.swift @@ -48,6 +48,22 @@ final public class PopupDialogContainerView: UIView { } } + /* + Having `cornerRadius` variable will create ambiguity with developers having it as a UIView extension. + In order to help them out, we can have functions doing the same functionality. + */ + /// Set the corner radius of the popup view + @objc public dynamic func setCornerRadius(_ radius: Float) { + let radius = CGFloat(radius) + shadowContainer.layer.cornerRadius = radius + container.layer.cornerRadius = radius + } + + /// Get the corner radius of the popup view + @objc public dynamic func getCornerRadius() -> Float { + return Float(shadowContainer.layer.cornerRadius) + } + // MARK: Shadow related /// Enable / disable shadow rendering of the container From 032f5bfc17ed3c7c4c6e44e0c8fcfe442f331ece Mon Sep 17 00:00:00 2001 From: Qutaibah Essa Date: Wed, 11 Jan 2023 13:58:46 +0300 Subject: [PATCH 2/2] resolve conflict with Obj-c setter --- PopupDialog/Classes/PopupDialogContainerView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PopupDialog/Classes/PopupDialogContainerView.swift b/PopupDialog/Classes/PopupDialogContainerView.swift index e8aa23f6..4a8214a0 100644 --- a/PopupDialog/Classes/PopupDialogContainerView.swift +++ b/PopupDialog/Classes/PopupDialogContainerView.swift @@ -53,7 +53,7 @@ final public class PopupDialogContainerView: UIView { In order to help them out, we can have functions doing the same functionality. */ /// Set the corner radius of the popup view - @objc public dynamic func setCornerRadius(_ radius: Float) { + @objc public dynamic func setupCornerRadius(_ radius: Float) { let radius = CGFloat(radius) shadowContainer.layer.cornerRadius = radius container.layer.cornerRadius = radius