refactored for custom fonts
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0fffd38113
commit
21ab644c16
@ -8,13 +8,14 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
/// Enum that is matched up for the Verizon fonts.
|
/// Enum that is matched up for the Verizon fonts.
|
||||||
public enum Font: String, FontProtocol {
|
public enum Font: FontProtocol {
|
||||||
case edsBold
|
case edsBold
|
||||||
case edsRegular
|
case edsRegular
|
||||||
case dsLight
|
case dsLight
|
||||||
case etxBold
|
case etxBold
|
||||||
case etxRegular
|
case etxRegular
|
||||||
|
case custom(String)
|
||||||
|
|
||||||
public var fontName: String {
|
public var fontName: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .edsBold:
|
case .edsBold:
|
||||||
@ -27,9 +28,15 @@ public enum Font: String, FontProtocol {
|
|||||||
return "VerizonNHGeTX-Bold"
|
return "VerizonNHGeTX-Bold"
|
||||||
case .etxRegular:
|
case .etxRegular:
|
||||||
return "VerizonNHGeTX-Regular"
|
return "VerizonNHGeTX-Regular"
|
||||||
|
case .custom(let fontName):
|
||||||
|
return fontName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static var allCases: [Font] {
|
||||||
|
[.edsBold, .edsRegular, .dsLight, .etxBold, .etxRegular]
|
||||||
|
}
|
||||||
|
|
||||||
/// File Extension for each of the Font enums.
|
/// File Extension for each of the Font enums.
|
||||||
public var fontFileExtension: String {
|
public var fontFileExtension: String {
|
||||||
return "otf"
|
return "otf"
|
||||||
|
|||||||
@ -9,9 +9,10 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
/// Used in Classes that require Fonts
|
/// Used in Classes that require Fonts
|
||||||
public protocol FontProtocol: CaseIterable, RawRepresentable, Hashable {
|
public protocol FontProtocol: Hashable {
|
||||||
var fontFileExtension: String { get }
|
var fontFileExtension: String { get }
|
||||||
var fontName: String { get }
|
var fontName: String { get }
|
||||||
|
static var allCases: [Self] { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
extension FontProtocol {
|
extension FontProtocol {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user