Files
divkit/client/ios/LayoutKitSnapshotTests/YSFontProvider.swift
T
pkurchatov 27a3472171 Enabled blankLinesBetweenImports swiftformat rule
commit_hash:84ea24cbdf21ef89741080f38ec5e583172a2458
2024-12-20 12:41:02 +03:00

24 lines
441 B
Swift

import UIKit
import VGSL
final class YSFontProvider: FontSpecifying {
func font(weight: FontWeight, size: CGFloat) -> UIFont {
UIFont(name: weight.fontName, size: size)!
}
}
extension FontWeight {
fileprivate var fontName: String {
switch self {
case .light:
"YSText-Light"
case .regular:
"YSText-Regular"
case .medium, .semibold:
"YSText-Medium"
case .bold:
"YSText-Bold"
}
}
}