added raw representable

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-06-16 08:37:45 -05:00
parent e59c8f0e40
commit a0ac8991f7

View File

@ -23,13 +23,22 @@ public enum TextPosition: String, CaseIterable {
}
}
public struct TextStyle: Equatable {
public struct TextStyle: Equatable, RawRepresentable {
public let rawValue: String
public let pointSize: CGFloat
public let lineHeight: CGFloat
public let letterSpacing: CGFloat
public let fontFace: Fonts
public init?(rawValue: String) {
guard let style = TextStyle.textStyle(for: rawValue) else { return nil }
self.rawValue = style.rawValue
self.pointSize = style.pointSize
self.lineHeight = style.lineHeight
self.letterSpacing = style.letterSpacing
self.fontFace = style.fontFace
}
public init(rawValue: String, fontFace: Fonts, pointSize: CGFloat, lineHeight: CGFloat, letterSpacing: CGFloat) {
self.rawValue = rawValue
self.fontFace = fontFace