From 8603cd7cb1f424dd7106a2e3d34a645db81ea247 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 14 Sep 2023 19:17:18 -0500 Subject: [PATCH 1/3] refactored Signed-off-by: Matt Bruce --- VDS/BaseClasses/Control.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/VDS/BaseClasses/Control.swift b/VDS/BaseClasses/Control.swift index ce90d271..e4ba8cde 100644 --- a/VDS/BaseClasses/Control.swift +++ b/VDS/BaseClasses/Control.swift @@ -78,12 +78,7 @@ open class Control: UIControl, ViewProtocol, UserInfoable, Clickable { } /// Whether the Control is enabled or not. - open override var isEnabled: Bool { - didSet { - setNeedsUpdate() - //isUserInteractionEnabled = isEnabled - } - } + open override var isEnabled: Bool { didSet { setNeedsUpdate() } } //-------------------------------------------------- // MARK: - Lifecycle From 55f922e5a1199d1146615fad93300e5632167d35 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 15 Sep 2023 14:57:17 -0500 Subject: [PATCH 2/3] fixed issue with line. Signed-off-by: Matt Bruce --- VDS/Components/Line/Line.swift | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Line/Line.swift b/VDS/Components/Line/Line.swift index 4135678f..17bf92c1 100644 --- a/VDS/Components/Line/Line.swift +++ b/VDS/Components/Line/Line.swift @@ -41,6 +41,12 @@ open class Line: View { case horizontal, vertical } + //-------------------------------------------------- + // MARK: - Configuration + //-------------------------------------------------- + /// Width of the line. + public let lineWidth: CGFloat = 1.0 + //-------------------------------------------------- // MARK: - Public Properties //-------------------------------------------------- @@ -83,9 +89,7 @@ open class Line: View { open override func updateView() { super.updateView() - backgroundColor = lineViewColorConfiguration.getColor(self) - - invalidateIntrinsicContentSize() + setNeedsDisplay() } /// Resets to default settings. @@ -94,4 +98,22 @@ open class Line: View { style = .primary orientation = .horizontal } + + open override func draw(_ rect: CGRect) { + guard let context = UIGraphicsGetCurrentContext() else { return } + + context.setStrokeColor(lineViewColorConfiguration.getColor(self).cgColor) + context.setLineWidth(lineWidth) + + if orientation == .horizontal { + context.move(to: CGPoint(x: 0, y: rect.height / 2)) + context.addLine(to: CGPoint(x: rect.width, y: rect.height / 2)) + } else { + context.move(to: CGPoint(x: rect.width / 2, y: 0)) + context.addLine(to: CGPoint(x: rect.width / 2, y: rect.height)) + } + + context.strokePath() + } + } From 924653a726ea928982e55c1b4730725c782418bf Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 15 Sep 2023 14:57:44 -0500 Subject: [PATCH 3/3] refactored code Signed-off-by: Matt Bruce --- VDS/Components/Icon/Icon.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/VDS/Components/Icon/Icon.swift b/VDS/Components/Icon/Icon.swift index 39b42175..e85dc751 100644 --- a/VDS/Components/Icon/Icon.swift +++ b/VDS/Components/Icon/Icon.swift @@ -69,9 +69,7 @@ open class Icon: View { open var customSize: Int? { didSet { setNeedsUpdate() } } /// The natural size for the receiving view, considering only properties of the view itself. - open override var intrinsicContentSize: CGSize { - dimensions - } + open override var intrinsicContentSize: CGSize { dimensions } //functions //--------------------------------------------------