updated Styler
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
2e937fd0de
commit
e3b335e6a6
@ -57,59 +57,6 @@ open class Styler {
|
||||
case B2 // Maps to RegularBodySmall
|
||||
case B3 // Maps to RegularMicro
|
||||
|
||||
/// Returns the font size of the current enum case.
|
||||
public func pointSize() -> CGFloat {
|
||||
switch self {
|
||||
case .RegularFeatureXLarge,
|
||||
.BoldFeatureXLarge:
|
||||
return 96
|
||||
case .RegularFeatureLarge,
|
||||
.BoldFeatureLarge:
|
||||
return 80
|
||||
case .RegularFeatureMedium,
|
||||
.BoldFeatureMedium:
|
||||
return 64
|
||||
case .RegularFeatureSmall,
|
||||
.BoldFeatureSmall:
|
||||
return 48
|
||||
case .RegularFeatureXSmall,
|
||||
.BoldFeatureXSmall,
|
||||
.RegularTitle2XLarge,
|
||||
.BoldTitle2XLarge,
|
||||
.Title2XLarge,
|
||||
.H1:
|
||||
return 40
|
||||
case .RegularTitleXLarge,
|
||||
.BoldTitleXLarge,
|
||||
.TitleXLarge,
|
||||
.H32:
|
||||
return 32
|
||||
case .BoldTitleLarge,
|
||||
.RegularTitleLarge,
|
||||
.H2:
|
||||
return 24
|
||||
case .BoldTitleMedium,
|
||||
.RegularTitleMedium,
|
||||
.H3:
|
||||
return 20
|
||||
case .RegularTitleSmall,
|
||||
.BoldTitleSmall,
|
||||
.BoldBodyLarge,
|
||||
.RegularBodyLarge,
|
||||
.B20:
|
||||
return 16
|
||||
case .RegularBodyMedium,
|
||||
.BoldBodyMedium:
|
||||
return 14
|
||||
case .BoldBodySmall, .B1,
|
||||
.RegularBodySmall, .B2:
|
||||
return 12
|
||||
case .BoldMicro,
|
||||
.RegularMicro, .B3:
|
||||
return 11
|
||||
}
|
||||
}
|
||||
|
||||
public func color() -> UIColor {
|
||||
switch self {
|
||||
case .B3:
|
||||
@ -148,8 +95,8 @@ open class Styler {
|
||||
|
||||
/// Returns the font based on the declared enum case.
|
||||
public func getFont(_ genericScaling: Bool = true) -> UIFont {
|
||||
let size = genericScaling ? sizeFontGeneric(forCurrentDevice: pointSize()) : pointSize()
|
||||
return MFStyler.getFontFor(size: size, isBold: isBold())
|
||||
let vdsStyle = vdsTextStyle() ?? .defaultStyle
|
||||
return vdsStyle.font
|
||||
}
|
||||
|
||||
/// Styles the provided label to the declared enum Font case.
|
||||
@ -237,7 +184,7 @@ open class Styler {
|
||||
/// Creates the appropriate VZW font for a VDS style, scaling based on the scaleValue threshold passed in.
|
||||
@objc static func getFontFor(styleString: String, scaleValue: CGFloat) -> UIFont? {
|
||||
guard let font = Styler.Font(rawValue: styleString),
|
||||
let size = Styler.Font(rawValue: styleString)?.pointSize(),
|
||||
let size = font.vdsTextStyle()?.pointSize,
|
||||
let newSize = Styler.sizeObjectGeneric(forCurrentDevice: size)?.getValueBased(onSize: scaleValue) else { return nil }
|
||||
return getFontFor(size: newSize, isBold: font.isBold())
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user