Merge branch 'feature/badgeIndicator' into 'develop'

updated

See merge request BPHV_MIPS/vds_ios!83
This commit is contained in:
Bruce, Matt R 2023-06-20 19:26:31 +00:00
commit bf709c4f5c
9 changed files with 226 additions and 209 deletions

View File

@ -37,7 +37,7 @@
EA3362072891E14D0071C351 /* VerizonNHGeDS-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = EA3362032891E14D0071C351 /* VerizonNHGeDS-Regular.otf */; };
EA33622C2891E73B0071C351 /* FontProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622B2891E73B0071C351 /* FontProtocol.swift */; };
EA33622E2891EA3C0071C351 /* DispatchQueue+Once.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622D2891EA3C0071C351 /* DispatchQueue+Once.swift */; };
EA3362302891EB4A0071C351 /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622F2891EB4A0071C351 /* Fonts.swift */; };
EA3362302891EB4A0071C351 /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33622F2891EB4A0071C351 /* Font.swift */; };
EA33623E2892EE950071C351 /* UIDevice.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33623D2892EE950071C351 /* UIDevice.swift */; };
EA3362402892EF6C0071C351 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33623F2892EF6B0071C351 /* Label.swift */; };
EA33624728931B050071C351 /* Initable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA33624628931B050071C351 /* Initable.swift */; };
@ -170,7 +170,7 @@
EA3362032891E14D0071C351 /* VerizonNHGeDS-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "VerizonNHGeDS-Regular.otf"; sourceTree = "<group>"; };
EA33622B2891E73B0071C351 /* FontProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontProtocol.swift; sourceTree = "<group>"; };
EA33622D2891EA3C0071C351 /* DispatchQueue+Once.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+Once.swift"; sourceTree = "<group>"; };
EA33622F2891EB4A0071C351 /* Fonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fonts.swift; sourceTree = "<group>"; };
EA33622F2891EB4A0071C351 /* Font.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
EA33623D2892EE950071C351 /* UIDevice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDevice.swift; sourceTree = "<group>"; };
EA33623F2892EF6B0071C351 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
EA33624628931B050071C351 /* Initable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Initable.swift; sourceTree = "<group>"; };
@ -497,7 +497,7 @@
EA3361DF2891D0F10071C351 /* Fonts */ = {
isa = PBXGroup;
children = (
EA33622F2891EB4A0071C351 /* Fonts.swift */,
EA33622F2891EB4A0071C351 /* Font.swift */,
EA33622B2891E73B0071C351 /* FontProtocol.swift */,
);
path = Fonts;
@ -945,7 +945,7 @@
EA33623E2892EE950071C351 /* UIDevice.swift in Sources */,
EA985C692971B90B00F2FF2E /* IconSize.swift in Sources */,
EA985C672970C21600F2FF2E /* VDSLayout.swift in Sources */,
EA3362302891EB4A0071C351 /* Fonts.swift in Sources */,
EA3362302891EB4A0071C351 /* Font.swift in Sources */,
EAF7F0AD289B142900B287F5 /* StrikeThroughLabelAttribute.swift in Sources */,
EAB5FEF12927F4AA00998C17 /* SelfSizingCollectionView.swift in Sources */,
EA3361B8288B2AAA0071C351 /* ViewProtocol.swift in Sources */,

View File

@ -52,80 +52,56 @@ open class BadgeIndicator: View {
}
}
public enum TextSize: String, CaseIterable {
public enum Size: String, CaseIterable {
case xxlarge = "2XLarge"
case xlarge = "XLarge"
case large = "Large"
case medium = "Medium"
case small = "Small"
public var inset: CGFloat {
return textStyle.pointSize * 0.3333
// switch self {
// case .xxlarge:
// return 8
// case .xlarge:
// return 6
// case .large:
// return 6
// case .medium:
// return 6
// case .small:
// return 4
// }
}
public var lineHeight: CGFloat {
switch self {
case .xxlarge:
return 29
case .xlarge:
return 24
case .large:
return 20
case .medium:
return 18
case .small:
return 16
}
}
public var textStyle: TextStyle {
let style = TextStyle.bodySmall
var pointSize: CGFloat = VDSTypography.fontSizeBody12
var letterSpacing: CGFloat = 0.0
switch self {
case .xxlarge:
pointSize = VDSTypography.fontSizeTitle24
letterSpacing = VDSTypography.letterSpacingWide
case .xlarge:
pointSize = VDSTypography.fontSizeTitle20
case .large:
pointSize = VDSTypography.fontSizeBody16
letterSpacing = VDSTypography.letterSpacingWide
case .medium:
pointSize = VDSTypography.fontSizeBody14
letterSpacing = VDSTypography.letterSpacingWide
case .small:
pointSize = VDSTypography.fontSizeBody12
}
// var ratio: CGFloat = 1.3333 // less than 14
// if pointSize > 13 && pointSize < 16 {
// ratio = 1.28
// } else if pointSize > 15 && pointSize < 19 {
// ratio = 1.25
// } else if pointSize > 19 {
// ratio = 1.20
// }
let calculatedLineHeight = pointSize * 1.265//ratio
print("lineHeight\noriginal: \(lineHeight)\ncalculated:\(calculatedLineHeight)")
return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator",
fontFace: style.fontFace,
pointSize: pointSize,
lineHeight: calculatedLineHeight,
letterSpacing: style.letterSpacing)
lineHeight: 0,
letterSpacing: letterSpacing)
}
public var edgeInset: UIEdgeInsets {
var horizontalPadding: CGFloat = VDSLayout.Spacing.space1X.value
let verticalPadding: CGFloat = 0
switch self {
case .xxlarge:
horizontalPadding = VDSLayout.Spacing.space2X.value
case .xlarge, .large,.medium:
horizontalPadding = 6.0
case .small:
break
}
return .init(top: verticalPadding, left: horizontalPadding, bottom: verticalPadding, right: horizontalPadding)
}
}
@ -171,7 +147,13 @@ open class BadgeIndicator: View {
open var leadingCharacter: String? { didSet { setNeedsUpdate() }}
open var textSize: TextSize = .xxlarge { didSet { setNeedsUpdate() }}
open var size: Size = .xxlarge { didSet { setNeedsUpdate() }}
open var dotSize: CGFloat? { didSet { setNeedsUpdate() }}
open var verticalPadding: CGFloat? { didSet { setNeedsUpdate() }}
open var horitonalPadding: CGFloat? { didSet { setNeedsUpdate() }}
open var hideDot: Bool = false { didSet { setNeedsUpdate() }}
@ -179,31 +161,56 @@ open class BadgeIndicator: View {
open var maxDigits: MaxDigits = .two { didSet { setNeedsUpdate() }}
open var width: CGFloat? { didSet { setNeedsUpdate() }}
open var height: CGFloat? { didSet { setNeedsUpdate() }}
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
private let borderWidth: CGFloat = 1.0
//--------------------------------------------------
// MARK: - Constraints
//--------------------------------------------------
private var labelWidthConstraint: NSLayoutConstraint?
private var labelHeightConstraint: NSLayoutConstraint?
private var defaultBadgeSize: CGFloat = 16
private let badgeView = View()
private var badgeSize: CGFloat { max(16.0, size.textStyle.font.lineHeight) }
private var widthConstraint: NSLayoutConstraint?
private var heightConstraint: NSLayoutConstraint?
private var labelContraints = NSLayoutConstraint.Container()
//--------------------------------------------------
// MARK: - Lifecycle
//--------------------------------------------------
open override func setup() {
super.setup()
addSubview(badgeView)
badgeView.addSubview(label)
accessibilityElements = [label]
addSubview(label)
label.pinToSuperView()
heightConstraint = badgeView.heightAnchor.constraint(greaterThanOrEqualToConstant: badgeSize)
heightConstraint?.isActive = true
widthConstraint = badgeView.widthAnchor.constraint(greaterThanOrEqualToConstant: badgeSize)
widthConstraint?.isActive = true
//we are insetting the padding to compensate for the border
NSLayoutConstraint.activate([
label.centerXAnchor.constraint(equalTo: centerXAnchor),
label.centerYAnchor.constraint(equalTo: centerYAnchor)
])
labelWidthConstraint = label.widthGreaterThanEqualTo(constant: defaultBadgeSize).activate()
labelHeightConstraint = label.heightGreaterThanEqualTo(constant: defaultBadgeSize).activate()
badgeView.topAnchor.constraint(equalTo: topAnchor, constant: borderWidth),
badgeView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -borderWidth),
badgeView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: borderWidth),
badgeView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -borderWidth)])
labelContraints.topConstraint = label.pinTopGreaterThanOrEqualTo(anchor: badgeView.topAnchor)
labelContraints.bottomConstraint = label.pinBottomGreaterThanOrEqualTo(anchor: badgeView.bottomAnchor)
labelContraints.leadingConstraint = label.pinLeadingGreaterThanOrEqualTo(anchor: badgeView.leadingAnchor)
labelContraints.trailingConstraint = label.pinTrailingGreaterThanOrEqualTo(anchor: badgeView.trailingAnchor)
label.centerXAnchor.constraint(equalTo: badgeView.centerXAnchor).isActive = true
label.centerYAnchor.constraint(equalTo: badgeView.centerYAnchor).isActive = true
labelContraints.isActive = true
}
open override func reset() {
@ -217,6 +224,19 @@ open class BadgeIndicator: View {
shouldUpdateView = true
setNeedsUpdate()
}
private var labelEdgeInset: UIEdgeInsets {
var newInset = size.edgeInset
if let verticalPadding, let horitonalPadding {
newInset = .init(top: verticalPadding, left: horitonalPadding, bottom: verticalPadding, right: horitonalPadding)
} else if let verticalPadding {
newInset = .init(top: verticalPadding, left: newInset.left, bottom: verticalPadding, right: newInset.right)
} else if let horitonalPadding {
newInset = .init(top: newInset.top, left: horitonalPadding, bottom: newInset.bottom, right: horitonalPadding)
}
return newInset
}
//--------------------------------------------------
// MARK: - Configuration
@ -264,12 +284,32 @@ open class BadgeIndicator: View {
open override func updateView() {
updateTextColorConfig()
backgroundColor = backgroundColorConfiguration.getColor(self)
badgeView.backgroundColor = backgroundColorConfiguration.getColor(self)
label.useAttributedText = true
label.edgeInset = .init(top: 0, left: textSize.inset, bottom: 0, right: textSize.inset)
label.font = textSize.textStyle.font
label.textColor = textColorConfiguration.getColor(self)
//height width
heightConstraint?.isActive = false
widthConstraint?.isActive = false
if let width, let height, height > badgeSize, width > badgeSize, height <= width {
heightConstraint = badgeView.heightAnchor.constraint(equalToConstant: height)
widthConstraint = badgeView.widthAnchor.constraint(equalToConstant: width)
} else {
heightConstraint = badgeView.heightAnchor.constraint(greaterThanOrEqualToConstant: badgeSize)
widthConstraint = badgeView.widthAnchor.constraint(greaterThanOrEqualToConstant: badgeSize)
}
heightConstraint?.isActive = true
widthConstraint?.isActive = true
//label constraints
let insets = labelEdgeInset
labelContraints.isActive = false
labelContraints.topConstraint?.constant = insets.top
labelContraints.bottomConstraint?.constant = -insets.bottom
labelContraints.leadingConstraint?.constant = insets.left
labelContraints.trailingConstraint?.constant = -insets.right
labelContraints.isActive = true
//label properties
label.textStyle = size.textStyle
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
label.text = getText()
label.surface = surface
@ -308,33 +348,42 @@ open class BadgeIndicator: View {
open override func layoutSubviews() {
super.layoutSubviews()
let size = textSize.textStyle.lineHeight
labelWidthConstraint?.constant = size
labelHeightConstraint?.constant = size
layer.cornerRadius = frame.size.height / 2
//update the cornerRadius
badgeView.layer.cornerRadius = badgeView.frame.size.height / 2
layer.cornerRadius = frame.size.height / 2
//border
if hideBorder {
layer.borderWidth = 0
} else {
layer.borderWidth = borderWidth
layer.borderColor = borderColorConfiguration.getColor(surface).cgColor
layer.borderWidth = 1
}
layer.remove(layerName: "dot")
//dot
badgeView.layer.remove(layerName: "dot")
if kind == .simple && !hideDot {
let dotSize: CGFloat = bounds.width * 0.1875
//frame for the dot to sit inside
let frame = badgeView.frame
//default calculation if a dotSize isn't given
var dot: CGFloat = frame.width * 0.1875
if let dotSize, dotSize < frame.width, dotSize < frame.height {
dot = dotSize
}
//get the center of the frame
let centerX = (frame.width - dot) / 2.0
let centerY = (frame.height - dot) / 2.0
//create the layer to draw the dot
let dotLayer = CAShapeLayer()
dotLayer.name = "dot"
let centerX = (bounds.width - dotSize) / 2.0
let centerY = (bounds.width - dotSize) / 2.0
dotLayer.frame = .init(x: centerX, y: centerY, width: dotSize, height: dotSize)
dotLayer.path = UIBezierPath(ovalIn: .init(origin: .zero, size: .init(width: dotSize, height: dotSize))).cgPath
dotLayer.frame = .init(x: centerX, y: centerY, width: dot, height: dot)
dotLayer.path = UIBezierPath(ovalIn: .init(origin: .zero, size: .init(width: dot, height: dot))).cgPath
dotLayer.fillColor = textColorConfiguration.getColor(self).cgColor
layer.addSublayer(dotLayer)
badgeView.layer.addSublayer(dotLayer)
}
}
}

View File

@ -169,42 +169,16 @@ open class ButtonBase: UIButton, Buttonable, Handlerable, ViewProtocol, Resettab
// MARK: - PRIVATE
//--------------------------------------------------
private func updateLabel() {
let font = textStyle.font
//clear the arrays holding actions
accessibilityCustomActions = []
//create the primary string
let startingAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor]
let mutableText = NSMutableAttributedString(string: text ?? "No Text", attributes: startingAttributes)
//set the local lineHeight/lineSpacing attributes
//get the range
let entireRange = NSRange(location: 0, length: mutableText.length)
//set letterSpacing
if textStyle.letterSpacing > 0.0 {
mutableText.addAttribute(.kern, value: textStyle.letterSpacing, range: entireRange)
}
let paragraph = NSMutableParagraphStyle().with {
$0.alignment = titleLabel?.textAlignment ?? .center
$0.lineBreakMode = titleLabel?.lineBreakMode ?? .byTruncatingTail
}
//set lineHeight
if textStyle.lineHeight > 0.0 {
let lineHeight = textStyle.lineHeight
let adjustment = lineHeight > font.lineHeight ? 2.0 : 1.0
let baselineOffset = (lineHeight - font.lineHeight) / 2.0 / adjustment
paragraph.maximumLineHeight = lineHeight
paragraph.minimumLineHeight = lineHeight
mutableText.addAttribute(.baselineOffset, value: baselineOffset, range: entireRange)
mutableText.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
} else {
mutableText.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
}
let mutableText = NSMutableAttributedString.mutableText(for: text ?? "No Text",
textStyle: textStyle,
textColor: textColor,
alignment: titleLabel?.textAlignment ?? .center,
lineBreakMode: titleLabel?.lineBreakMode ?? .byTruncatingTail)
if let attributes = attributes {
//loop through the models attributes

View File

@ -38,15 +38,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }}
open var userInfo = [String: Primitive]()
open var edgeInset: UIEdgeInsets = .zero {
didSet {
setNeedsUpdate()
}
}
override open var text: String? {
didSet {
attributes = nil
@ -118,20 +110,15 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
//--------------------------------------------------
open func updateView() {
if !useAttributedText {
textAlignment = textPosition.textAlignment
textColor = textColorConfiguration.getColor(self)
font = textStyle.font
if let text = text, let font = font, let textColor = textColor {
if let text = text {
accessibilityCustomActions = []
//clear the arrays holding actions
//create the primary string
let startingAttributes = [NSAttributedString.Key.font: font, NSAttributedString.Key.foregroundColor: textColor]
let mutableText = NSMutableAttributedString(string: text, attributes: startingAttributes)
//set the local lineHeight/lineSpacing attributes
setStyleAttributes(attributedString: mutableText)
let mutableText = NSMutableAttributedString.mutableText(for: text,
textStyle: textStyle,
textColor: textColorConfiguration.getColor(self),
alignment: textPosition.textAlignment,
lineBreakMode: lineBreakMode)
applyAttributes(mutableText)
@ -168,48 +155,7 @@ open class Label: UILabel, Handlerable, ViewProtocol, Resettable, UserInfoable {
}
}
}
private func setStyleAttributes(attributedString: NSMutableAttributedString) {
//get the range
let entireRange = NSRange(location: 0, length: attributedString.length)
//set letterSpacing
if textStyle.letterSpacing > 0.0 {
attributedString.addAttribute(.kern, value: textStyle.letterSpacing, range: entireRange)
}
//set lineHeight
if textStyle.lineHeight > 0.0 {
let lineHeight = textStyle.lineHeight
let adjustment = lineHeight > font.lineHeight ? 2.0 : 1.0
let baselineOffset = (lineHeight - font.lineHeight) / 2.0 / adjustment
let paragraph = NSMutableParagraphStyle().with {
$0.maximumLineHeight = lineHeight
$0.minimumLineHeight = lineHeight
$0.alignment = textPosition.textAlignment
$0.lineBreakMode = lineBreakMode
}
attributedString.addAttribute(.baselineOffset, value: baselineOffset, range: entireRange)
attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
} else if textPosition != .left {
let paragraph = NSMutableParagraphStyle().with {
$0.alignment = textPosition.textAlignment
$0.lineBreakMode = lineBreakMode
}
attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
}
}
open override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: edgeInset))
}
open override var intrinsicContentSize: CGSize {
let size = super.intrinsicContentSize
return CGSize(width: size.width + edgeInset.left + edgeInset.right, height: size.height + edgeInset.top + edgeInset.bottom)
}
//--------------------------------------------------
// MARK: - Actionable
//--------------------------------------------------

View File

@ -17,3 +17,33 @@ extension NSAttributedString {
return NSAttributedString(attachment: spacerAttachment)
}
}
extension NSMutableAttributedString {
public static func mutableText(for text: String, textStyle: TextStyle, textColor: UIColor, alignment: NSTextAlignment = .left, lineBreakMode: NSLineBreakMode) -> NSMutableAttributedString {
let startingAttributes = [NSAttributedString.Key.font: textStyle.font, NSAttributedString.Key.foregroundColor: textColor]
let attributedString = NSMutableAttributedString(string: text, attributes: startingAttributes)
//get the range
let entireRange = NSRange(location: 0, length: attributedString.length)
//set letterSpacing
if textStyle.letterSpacing > 0.0 {
attributedString.addAttribute(.kern, value: textStyle.letterSpacing, range: entireRange)
}
let paragraph = NSMutableParagraphStyle()
paragraph.alignment = alignment
paragraph.lineBreakMode = lineBreakMode
//set lineHeight
if textStyle.lineHeight > 0.0 {
let lineHeight = textStyle.lineHeight
paragraph.maximumLineHeight = lineHeight
paragraph.minimumLineHeight = lineHeight
}
attributedString.addAttribute( .paragraphStyle, value: paragraph, range: entireRange)
return attributedString
}
}

View File

@ -339,6 +339,17 @@ extension NSLayoutConstraint {
public var widthConstraint: NSLayoutConstraint?
public var heightConstraint: NSLayoutConstraint?
public var isActive: Bool = false {
didSet{
topConstraint?.isActive = isActive
bottomConstraint?.isActive = isActive
leadingConstraint?.isActive = isActive
trailingConstraint?.isActive = isActive
heightConstraint?.isActive = isActive
widthConstraint?.isActive = isActive
}
}
public init(){}
}

View File

@ -7,7 +7,7 @@
import Foundation
public enum Fonts: String, FontProtocol {
public enum Font: String, FontProtocol {
case dsBold
case dsRegular
case dsLight

View File

@ -1,4 +1,8 @@
1.0.23
1.0.25
=======
- Added Size, Width, Height, Horizontal/Vertical Padding + more to Badge Indicator
1.0.24
=======
- Added Badge Indicator
- Refactored the TextStyle system to support Badge Indicator

View File

@ -28,7 +28,7 @@ public struct TextStyle: Equatable, RawRepresentable {
public let pointSize: CGFloat
public let lineHeight: CGFloat
public let letterSpacing: CGFloat
public let fontFace: Fonts
public let fontFace: Font
public init?(rawValue: String) {
guard let style = TextStyle.textStyle(for: rawValue) else { return nil }
@ -39,7 +39,7 @@ public struct TextStyle: Equatable, RawRepresentable {
self.fontFace = style.fontFace
}
public init(rawValue: String, fontFace: Fonts, pointSize: CGFloat, lineHeight: CGFloat, letterSpacing: CGFloat) {
public init(rawValue: String, fontFace: Font, pointSize: CGFloat = 0.0, lineHeight: CGFloat = 0.0, letterSpacing: CGFloat = 0.0) {
self.rawValue = rawValue
self.fontFace = fontFace
self.pointSize = pointSize
@ -48,6 +48,9 @@ public struct TextStyle: Equatable, RawRepresentable {
}
}
extension VDSTypography {
public static let letterSpacingSemiWide: CGFloat = 0.25
}
//MARK: Definitions
extension TextStyle {
@ -56,169 +59,169 @@ extension TextStyle {
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldFeatureXLarge = TextStyle(rawValue: "boldFeatureXLarge",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature144 : VDSTypography.fontSizeFeature96,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature136 : VDSTypography.lineHeightFeature88,
letterSpacing: 0.25)
letterSpacing: 0)
public static let featureLarge = TextStyle(rawValue: "featureLarge",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldFeatureLarge = TextStyle(rawValue: "boldFeatureLarge",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature128 : VDSTypography.fontSizeFeature80,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature120 : VDSTypography.lineHeightFeature76,
letterSpacing: 0.25)
letterSpacing: 0)
public static let featureMedium = TextStyle(rawValue: "featureMedium",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldFeatureMedium = TextStyle(rawValue: "boldFeatureMedium",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature96 : VDSTypography.fontSizeFeature64,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature88 : VDSTypography.lineHeightFeature64,
letterSpacing: 0.25)
letterSpacing: 0)
public static let featureSmall = TextStyle(rawValue: "featureSmall",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldFeatureSmall = TextStyle(rawValue: "boldFeatureSmall",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature80 : VDSTypography.fontSizeFeature48,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature76 : VDSTypography.lineHeightFeature48,
letterSpacing: 0.25)
letterSpacing: 0)
public static let featureXSmall = TextStyle(rawValue: "featureXSmall",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldFeatureXSmall = TextStyle(rawValue: "boldFeatureXSmall",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeFeature64 : VDSTypography.fontSizeFeature40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightFeature64 : VDSTypography.lineHeightFeature40,
letterSpacing: 0.25)
letterSpacing: 0)
public static let title2XLarge = TextStyle(rawValue: "title2XLarge",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle64 : VDSTypography.lineHeightTitle40,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldTitle2XLarge = TextStyle(rawValue: "boldTitle2XLarge",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle64 : VDSTypography.fontSizeTitle40,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle64 : VDSTypography.lineHeightTitle40,
letterSpacing: 0.25)
letterSpacing: 0)
public static let titleXLarge = TextStyle(rawValue: "titleXLarge",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldTitleXLarge = TextStyle(rawValue: "boldTitleXLarge",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle48 : VDSTypography.fontSizeTitle32,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle48 : VDSTypography.lineHeightTitle36,
letterSpacing: 0.25)
letterSpacing: 0)
public static let titleLarge = TextStyle(rawValue: "titleLarge",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28,
letterSpacing: 0.25)
letterSpacing: VDSTypography.letterSpacingSemiWide)
public static let boldTitleLarge = TextStyle(rawValue: "boldTitleLarge",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle32 : VDSTypography.fontSizeTitle24,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle36 : VDSTypography.lineHeightTitle28,
letterSpacing: 0.25)
letterSpacing: 0)
public static let titleMedium = TextStyle(rawValue: "titleMedium",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24,
letterSpacing: 0.25)
letterSpacing: 0)
public static let boldTitleMedium = TextStyle(rawValue: "boldTitleMedium",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle24 : VDSTypography.fontSizeTitle20,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle28 : VDSTypography.lineHeightTitle24,
letterSpacing: 0.25)
letterSpacing: 0)
public static let titleSmall = TextStyle(rawValue: "titleSmall",
fontFace: .dsLight,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20,
letterSpacing: 0.25)
letterSpacing: 0)
public static let boldTitleSmall = TextStyle(rawValue: "boldTitleSmall",
fontFace: .dsBold,
pointSize: UIDevice.isIPad ? VDSTypography.fontSizeTitle20 : VDSTypography.fontSizeTitle16,
lineHeight: UIDevice.isIPad ? VDSTypography.lineHeightTitle24 : VDSTypography.lineHeightTitle20,
letterSpacing: 0.25)
letterSpacing: 0)
public static let bodyLarge = TextStyle(rawValue: "bodyLarge",
fontFace: .dsRegular,
pointSize: VDSTypography.fontSizeBody16,
lineHeight: VDSTypography.lineHeightBody20,
letterSpacing: 0.5)
letterSpacing:VDSTypography.letterSpacingWide)
public static let boldBodyLarge = TextStyle(rawValue: "boldBodyLarge",
fontFace: .dsBold,
pointSize: VDSTypography.fontSizeBody16,
lineHeight: VDSTypography.lineHeightBody20,
letterSpacing: 0.5)
letterSpacing: VDSTypography.letterSpacingWide)
public static let bodyMedium = TextStyle(rawValue: "bodyMedium",
fontFace: .dsRegular,
pointSize: VDSTypography.fontSizeBody14,
lineHeight: VDSTypography.lineHeightBody18,
letterSpacing: 0.5)
letterSpacing: VDSTypography.letterSpacingWide)
public static let boldBodyMedium = TextStyle(rawValue: "boldBodyMedium",
fontFace: .dsBold,
pointSize: VDSTypography.fontSizeBody14,
lineHeight: VDSTypography.lineHeightBody18,
letterSpacing: 0.5)
letterSpacing: VDSTypography.letterSpacingWide)
public static let bodySmall = TextStyle(rawValue: "bodySmall",
fontFace: .dsRegular,
pointSize: VDSTypography.fontSizeBody12,
lineHeight: VDSTypography.lineHeightBody16,
letterSpacing: 0.25)
letterSpacing: 0)
public static let boldBodySmall = TextStyle(rawValue: "boldBodySmall",
fontFace: .dsBold,
pointSize: VDSTypography.fontSizeBody12,
lineHeight: VDSTypography.lineHeightBody16,
letterSpacing: 0.5)
letterSpacing: 0)
public static let micro = TextStyle(rawValue: "micro",
fontFace: .dsRegular,
pointSize: VDSTypography.fontSizeMicro11,
lineHeight: VDSTypography.lineHeightMicro16,
letterSpacing: 0.25)
letterSpacing: 0)
public static let boldMicro = TextStyle(rawValue: "boldMicro",
fontFace: .dsBold,
pointSize: VDSTypography.fontSizeMicro11,
lineHeight: VDSTypography.lineHeightMicro16,
letterSpacing: 0.5)
letterSpacing: 0)
public static var allCases: [TextStyle] {
return [