// Copyright SIX DAY LLC. All rights reserved. import Foundation import UIKit extension CALayer { func addBorder(edge: UIRectEdge, color: UIColor, thickness: CGFloat) { let border = CALayer() switch edge { case UIRectEdge.top: border.frame = CGRect.init(x: 0, y: 0, width: frame.width, height: thickness) case UIRectEdge.bottom: border.frame = CGRect.init(x: 0, y: frame.height - thickness, width: frame.width, height: thickness) case UIRectEdge.left: border.frame = CGRect.init(x: 0, y: 0, width: thickness, height: frame.height) case UIRectEdge.right: border.frame = CGRect.init(x: frame.width - thickness, y: 0, width: thickness, height: frame.height) default: break } border.backgroundColor = color.cgColor self.addSublayer(border) } }