Commit 8bffd954 authored by Jose Blaya's avatar Jose Blaya
Browse files

New method in Theme to stand out a small label

parent ccfa7dbe
......@@ -386,6 +386,29 @@ public class Theme {
textView.textColor = palette.textColor(forRelevance: 3, appearance: .dark)
}
/// Method to apply a second style for the same UILabel
/// label.text should be previously set
public func makeSmallLabelToStandOut(_ label: UILabel,
withTextToStandOut textToStandOut: String,
andAppearance appearance: Appearance = Appearance.dark) {
if let text = label.text {
let rangeSecondText = (text as NSString).range(of: textToStandOut)
let attributedString = NSMutableAttributedString(string: text)
attributedString.addAttribute(.foregroundColor,
value: palette.textColor(forRelevance: 2,
appearance: appearance),
range: rangeSecondText)
attributedString.addAttribute(.font,
value: typeface.mediumFont(size: 13.0),
range: rangeSecondText)
label.attributedText = attributedString
}
}
/// :nodoc:
public func applyTag(_ label: UILabel, appearance: Appearance) {
label.font = typeface.regularFont(size: 12.0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment