Created
January 13, 2022 20:06
-
-
Save chrisvasselli/c76f68c9a79d79b771ae36701dac06f5 to your computer and use it in GitHub Desktop.
This file contains 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
import Foundation | |
extension UIView { | |
@IBInspectable var cornerRadius: CGFloat { | |
get { | |
return layer.cornerRadius | |
} | |
set { | |
layer.cornerRadius = newValue | |
layer.masksToBounds = newValue > 0 | |
} | |
} | |
@IBInspectable var borderWidth: CGFloat { | |
get { | |
return layer.borderWidth | |
} | |
set { | |
layer.borderWidth = newValue | |
} | |
} | |
@IBInspectable var borderColor: UIColor? { | |
get { | |
return UIColor(cgColor: layer.borderColor!) | |
} | |
set { | |
layer.borderColor = newValue?.cgColor | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment