refactored for custom fonts

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-08 10:08:32 -06:00
parent 0fffd38113
commit 21ab644c16
2 changed files with 11 additions and 3 deletions

View File

@ -8,13 +8,14 @@
import Foundation
/// Enum that is matched up for the Verizon fonts.
public enum Font: String, FontProtocol {
public enum Font: FontProtocol {
case edsBold
case edsRegular
case dsLight
case etxBold
case etxRegular
case custom(String)
public var fontName: String {
switch self {
case .edsBold:
@ -27,9 +28,15 @@ public enum Font: String, FontProtocol {
return "VerizonNHGeTX-Bold"
case .etxRegular:
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.
public var fontFileExtension: String {
return "otf"

View File

@ -9,9 +9,10 @@ import Foundation
import UIKit
/// Used in Classes that require Fonts
public protocol FontProtocol: CaseIterable, RawRepresentable, Hashable {
public protocol FontProtocol: Hashable {
var fontFileExtension: String { get }
var fontName: String { get }
static var allCases: [Self] { get }
}
extension FontProtocol {