From 5f8780614f881ce8b38946cdf1ef090365bfa86c Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Fri, 27 Sep 2019 14:28:16 -0400 Subject: [PATCH] borders. --- MVMCoreUI/Atoms/Views/Checkbox.swift | 29 ++++++++-------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atoms/Views/Checkbox.swift index 29ecc3c6..d0599043 100644 --- a/MVMCoreUI/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atoms/Views/Checkbox.swift @@ -8,7 +8,9 @@ import MVMCore - +/** + This class expects its height and width to be equal. + */ @objcMembers open class Checkbox: UIControl, MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol { //-------------------------------------------------- // MARK: - Properties @@ -41,23 +43,8 @@ import MVMCore public var lineWidth: CGFloat = 2 public var lineColor: UIColor = .black - - open var borderColor: UIColor { - get { - guard let color = layer.borderColor else { return .black } - return UIColor(cgColor: color) - } - set (newColor) { - layer.borderColor = newColor.cgColor - } - } - - open var borderWidth: CGFloat { - get { return layer.borderWidth } - set (newWidth) { - layer.borderWidth = newWidth - } - } + public var borderColor: UIColor = .black + public var borderWidth: CGFloat = 1 override open var isSelected: Bool { didSet { @@ -141,15 +128,15 @@ import MVMCore super.layoutSubviews() drawCheck() layer.cornerRadius = hasRoundedCorners ? cornerRadiusValue : 0 - backgroundColor = unCheckedBackgroundColor ?? .white + backgroundColor = unCheckedBackgroundColor + layer.borderWidth = borderWidth + layer.borderColor = borderColor.cgColor } public func setupView() { isUserInteractionEnabled = true translatesAutoresizingMaskIntoConstraints = false - layer.borderWidth = 1 - layer.borderColor = UIColor.black.cgColor } //--------------------------------------------------