made register static
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
0207b70a20
commit
38310b5ab1
@ -48,7 +48,7 @@ public enum Font: FontProtocol {
|
|||||||
/// - size: Size of the font
|
/// - size: Size of the font
|
||||||
/// - Returns: UIFont for the fontName and Size.
|
/// - Returns: UIFont for the fontName and Size.
|
||||||
public func font(ofSize size: CGFloat) -> UIFont{
|
public func font(ofSize size: CGFloat) -> UIFont{
|
||||||
DispatchQueue.once(block: { self.register() })
|
DispatchQueue.once(block: { Self.register() })
|
||||||
switch self {
|
switch self {
|
||||||
case .custom(let font):
|
case .custom(let font):
|
||||||
return font
|
return font
|
||||||
|
|||||||
@ -18,7 +18,7 @@ public protocol FontProtocol {
|
|||||||
extension FontProtocol {
|
extension FontProtocol {
|
||||||
|
|
||||||
/// Registers the fonts used in the VDS Framework.
|
/// Registers the fonts used in the VDS Framework.
|
||||||
public func register() {
|
public static func register() {
|
||||||
guard let bundle = Bundle(identifier: "com.vzw.vds") else { return }
|
guard let bundle = Bundle(identifier: "com.vzw.vds") else { return }
|
||||||
Self.allCases.forEach{ font in
|
Self.allCases.forEach{ font in
|
||||||
if let url = bundle.url(forResource: font.fontName, withExtension: font.fontFileExtension){
|
if let url = bundle.url(forResource: font.fontName, withExtension: font.fontFileExtension){
|
||||||
@ -51,7 +51,7 @@ extension FontProtocol {
|
|||||||
/// - size: Size of the font
|
/// - size: Size of the font
|
||||||
/// - Returns: UIFont for the fontName and Size.
|
/// - Returns: UIFont for the fontName and Size.
|
||||||
public func font(ofSize size: CGFloat) -> UIFont{
|
public func font(ofSize size: CGFloat) -> UIFont{
|
||||||
DispatchQueue.once(block: { self.register() })
|
DispatchQueue.once(block: { Self.register() })
|
||||||
guard let found = UIFont(name: self.fontName, size: size) else { return .systemFont(ofSize: size) }
|
guard let found = UIFont(name: self.fontName, size: size) else { return .systemFont(ofSize: size) }
|
||||||
return found
|
return found
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user