diff --git a/Idea-Archive/Sources/DesignSystem/Sources/Label/MajorsLabel.swift b/Idea-Archive/Sources/DesignSystem/Sources/Label/MajorsLabel.swift index e69de29..7bff5e8 100644 --- a/Idea-Archive/Sources/DesignSystem/Sources/Label/MajorsLabel.swift +++ b/Idea-Archive/Sources/DesignSystem/Sources/Label/MajorsLabel.swift @@ -0,0 +1,22 @@ +import UIKit + +class MajorsLabel: UILabel { + private var padding = UIEdgeInsets(top: 6.0, left: 12.0, bottom: 6.0, right: 12.0) + + convenience init(padding: UIEdgeInsets) { + self.init() + self.padding = padding + } + + override func drawText(in rect: CGRect) { + super.drawText(in: rect.inset(by: padding)) + } + + override var intrinsicContentSize: CGSize { + var contentSize = super.intrinsicContentSize + contentSize.height += padding.top + padding.bottom + contentSize.width += padding.left + padding.right + + return contentSize + } +}