Skip to content

Instantly share code, notes, and snippets.

@agiletalk
Created November 2, 2016 03:34
Show Gist options
  • Save agiletalk/8620657d3a17529e6c3f7e9d3c446228 to your computer and use it in GitHub Desktop.
Save agiletalk/8620657d3a17529e6c3f7e9d3c446228 to your computer and use it in GitHub Desktop.
import UIKit
@IBDesignable
class RoundedButton: UIButton {
@IBInspectable var cornerRadius: CGFloat = 0 {
didSet {
layer.cornerRadius = cornerRadius
layer.masksToBounds = cornerRadius > 0
}
}
@IBInspectable var borderWidth: CGFloat = 0 {
didSet {
layer.borderWidth = borderWidth
}
}
@IBInspectable var borderColor: UIColor? {
didSet {
layer.borderColor = borderColor?.CGColor
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment