                     withTopOffset top: CGFloat = 0, bottomOffset bottom: CGFloat = 0,
                     useConstraints: Bool = true) {
         if useConstraints {
-            let borderView = addBorderView(from: border, horizontal: false)
+            let borderView = addBorderView(from: border, direction: .Vertical)
             borderView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true
             borderView.topAnchor.constraint(equalTo: topAnchor, constant: top).isActive = true
             bottomAnchor.constraint(equalTo: borderView.bottomAnchor, constant: bottom).isActive = true

                    withLeftOffset left: CGFloat = 0, rightOffset right: CGFloat = 0,
                    useConstraints: Bool = true) {
        if useConstraints {
            let borderView = addBorderView(from: border, horizontal: true)
            borderView.topAnchor.constraint(equalTo: topAnchor).isActive = true
            borderView.leftAnchor.constraint(equalTo: leftAnchor, constant: left).isActive = true
            rightAnchor.constraint(equalTo: borderView.rightAnchor, constant: right).isActive = true


extension UIView {
    
    private enum Direction {
        case Horizontal
        case Vertical
    }
    
    private func addBorderView(from border: ViewBorder, direction: Direction) -> UIView {
        let borderView = UIView(frame: .zero)
        borderView.backgroundColor = border.color
        addSubview(borderView)
        borderView.translatesAutoresizingMaskIntoConstraints = false
        let anchor = (direction == .Horizontal) ? borderView.heightAnchor : borderView.widthAnchor
        anchor.constraint(equalToConstant: CGFloat(border.thickness)).isActive = true
        return borderView
    }
