Created
August 28, 2015 14:54
-
-
Save christophercotton/60f786a82445eac804e0 to your computer and use it in GitHub Desktop.
Adds inspectable properties to allow editing of the border and corner radius
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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