Skip to content

Instantly share code, notes, and snippets.

@pbonneville
Forked from PabloDomine/RoundedButton.swift
Created November 11, 2016 01:43
Show Gist options
  • Save pbonneville/60ed01d8efbe445e12b6f8f5ea01a1bb to your computer and use it in GitHub Desktop.
Save pbonneville/60ed01d8efbe445e12b6f8f5ea01a1bb 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