123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- import Foundation
- @IBDesignable class NCAvatar: UIImageView {
-
- @IBInspectable var roundness: CGFloat = 2 {
- didSet{
- layoutSubviews()
- }
- }
-
- @IBInspectable var borderWidth: CGFloat = 1 {
- didSet{
- layoutSubviews()
- }
- }
-
- @IBInspectable var borderColor: UIColor = NCBrandColor.shared.avatarBorder {
- didSet{
- layoutSubviews()
- }
- }
-
- @IBInspectable var background: UIColor = UIColor.clear {
- didSet{
- layoutSubviews()
- }
- }
-
- required init?(coder aDecoder: NSCoder) {
- super.init(coder: aDecoder)
- }
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- }
-
- override func layoutSubviews() {
- super.layoutSubviews()
-
- self.avatar(roundness: roundness, borderWidth: borderWidth, borderColor: borderColor, backgroundColor: background)
- }
- }
|