added raw representable
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e59c8f0e40
commit
a0ac8991f7
@ -23,13 +23,22 @@ public enum TextPosition: String, CaseIterable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct TextStyle: Equatable {
|
public struct TextStyle: Equatable, RawRepresentable {
|
||||||
public let rawValue: String
|
public let rawValue: String
|
||||||
public let pointSize: CGFloat
|
public let pointSize: CGFloat
|
||||||
public let lineHeight: CGFloat
|
public let lineHeight: CGFloat
|
||||||
public let letterSpacing: CGFloat
|
public let letterSpacing: CGFloat
|
||||||
public let fontFace: Fonts
|
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) {
|
public init(rawValue: String, fontFace: Fonts, pointSize: CGFloat, lineHeight: CGFloat, letterSpacing: CGFloat) {
|
||||||
self.rawValue = rawValue
|
self.rawValue = rawValue
|
||||||
self.fontFace = fontFace
|
self.fontFace = fontFace
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user