I Set CornerRadius and BorderWidth for UIbutton in User Defined Runtime Attributes. Without adding layer.borderColor it works Well and Display border in bla
In case of Swift, function doesn't work. You'll need a computed property to achieve the desired result:
extension CALayer { var borderColorFromUIColor: UIColor { get { return UIColor(CGColor: self.borderColor!) } set { self.borderColor = newValue.CGColor } } }