diff --git a/DropDown/helpers/DPDConstants.swift b/DropDown/helpers/DPDConstants.swift index a7e0683..440c327 100644 --- a/DropDown/helpers/DPDConstants.swift +++ b/DropDown/helpers/DPDConstants.swift @@ -32,6 +32,8 @@ internal struct DPDConstant { static let CornerRadius: CGFloat = 2 static let RowHeight: CGFloat = 44 static let HeightPadding: CGFloat = 20 + static let BorderWidth : CGFloat = 0.0 + static let BorderColor : CGColor = UIColor.clear.cgColor struct Shadow { diff --git a/DropDown/src/DropDown.swift b/DropDown/src/DropDown.swift index a1b6b39..2772db4 100644 --- a/DropDown/src/DropDown.swift +++ b/DropDown/src/DropDown.swift @@ -222,6 +222,32 @@ public final class DropDown: UIView { } didSet { reloadAllComponents() } } + + /** + The borderWidth of DropDown. + + Changing the corner borderWidth automatically reloads the drop down. + */ + @objc public dynamic var borderWidth = DPDConstant.UI.BorderWidth { + willSet { + tableViewContainer.layer.borderWidth = newValue + tableView.layer.borderWidth = newValue + } + didSet { reloadAllComponents() } + } + + /** + The borderColor of DropDown. + + Changing the corner borderColor automatically reloads the drop down. + */ + @objc public dynamic var borderColor = DPDConstant.UI.BorderColor { + willSet { + tableViewContainer.layer.borderColor = newValue + tableView.layer.borderColor = newValue + } + didSet { reloadAllComponents() } + } /** The color of the shadow. @@ -503,6 +529,8 @@ private extension DropDown { tableView.separatorColor = separatorColor tableView.layer.cornerRadius = cornerRadius tableView.layer.masksToBounds = true + tableView.layer.borderColor = borderColor + tableView.layer.borderWidth = borderWidth } }