allow for textColor first.

This commit is contained in:
Kevin G Christiano 2020-10-05 18:03:35 -04:00
parent eba33717b5
commit 7643b86b51
2 changed files with 5 additions and 3 deletions

View File

@ -324,7 +324,9 @@ public typealias ActionBlock = () -> ()
switch attribute {
case let underlineAtt as LabelAttributeUnderlineModel:
attributedString.addAttribute(.underlineStyle, value: underlineAtt.underlineValue.rawValue, range: range)
attributedString.addAttribute(.underlineColor, value: underlineAtt.color.uiColor, range: range)
if let underlineColor = underlineAtt.color?.uiColor {
attributedString.addAttribute(.underlineColor, value: underlineColor, range: range)
}
case _ as LabelAttributeStrikeThroughModel:
attributedString.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.thick.rawValue, range: range)

View File

@ -29,7 +29,7 @@ import UIKit
}
}
var color: Color = Color(uiColor: .mvmBlack)
var color: Color?
var style: UnderlineStyle = .single
var pattern: UnderlineStyle.Pattern?
@ -64,7 +64,7 @@ import UIKit
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(color, forKey: .color)
try container.encodeIfPresent(color, forKey: .color)
try container.encode(style, forKey: .style)
try container.encodeIfPresent(pattern, forKey: .pattern)
}