From e15a4321b33da841020910db0239b1f305754799 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Wed, 14 Feb 2024 10:48:44 -0600 Subject: [PATCH] removed Type/type added layoutSubViews to deal with cornerRadius logic. Signed-off-by: Matt Bruce --- VDS/Components/Notification/Notification.swift | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/VDS/Components/Notification/Notification.swift b/VDS/Components/Notification/Notification.swift index f24d2bd6..2ed84116 100644 --- a/VDS/Components/Notification/Notification.swift +++ b/VDS/Components/Notification/Notification.swift @@ -58,11 +58,6 @@ open class Notification: View { case vertical, horizontal } - /// Enum used to describe the type of the Notification. - public enum `Type`: String, CaseIterable { - case fullBleed, inLine - } - //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- @@ -177,9 +172,6 @@ open class Notification: View { /// Add this attribute determine your type of Notification. open var style: Style = .info { didSet { setNeedsUpdate()}} - - /// If true, will hide the close button. - open var type: Type = .inLine { didSet { setNeedsUpdate()} } private var _layout: Layout = .vertical @@ -333,7 +325,6 @@ open class Notification: View { open override func updateView() { super.updateView() - layer.cornerRadius = type == .fullBleed ? 0 : 4.0 backgroundColor = backgroundColorConfiguration.getColor(self) updateIcons() updateLabels() @@ -341,6 +332,12 @@ open class Notification: View { setConstraints() } + /// Override to check the screen width to determine cornerRadius + open override func layoutSubviews() { + super.layoutSubviews() + layer.cornerRadius = UIScreen.main.bounds.width == bounds.width ? 0 : 4.0 + } + //-------------------------------------------------- // MARK: - Private Methods //--------------------------------------------------