added a conversion of a UIFont to a TextStyle
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
21ab644c16
commit
23f3f8b6bf
@ -209,6 +209,24 @@ extension TextStyle {
|
|||||||
boldMicro
|
boldMicro
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static func convert(font: UIFont) -> TextStyle {
|
||||||
|
var found: TextStyle?
|
||||||
|
|
||||||
|
for textStyle in allCases {
|
||||||
|
if font.fontName == textStyle.fontFace.fontName &&
|
||||||
|
font.pointSize == textStyle.pointSize {
|
||||||
|
found = textStyle
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let found else {
|
||||||
|
return TextStyle(rawValue: "Custom", fontFace: .custom(font.fontName), pointSize: font.pointSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
return found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TextStyle {
|
extension TextStyle {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user