Skip to content

Instantly share code, notes, and snippets.

@christophercotton
Created August 28, 2015 14:54
Show Gist options
  • Save christophercotton/60f786a82445eac804e0 to your computer and use it in GitHub Desktop.
Save christophercotton/60f786a82445eac804e0 to your computer and use it in GitHub Desktop.
Adds inspectable properties to allow editing of the border and corner radius
// UIView+Inspectable.swift
//
// Created by Christopher Cotton. No Copyright
import UIKit
extension UIView {
@IBInspectable var borderColor:UIColor {
set {
layer.borderColor = newValue.CGColor
}
get {
return UIColor(CGColor: layer.borderColor)!
}
}
@IBInspectable var borderWidth:CGFloat {
set {
layer.borderWidth = newValue
}
get {
return layer.borderWidth
}
}
@IBInspectable var cornerRadius:CGFloat {
set {
layer.cornerRadius = newValue
}
get {
return layer.cornerRadius
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment