ReactantUI
ReactantUI copied to clipboard
Add global fonts.
OpenSans.font.xml
<font>
<variant name="light" identifier="OpenSans-Light" />
<variant name="regular" identifier="OpenSans" />
<variant name="semibold" identifier="OpenSans-Semibold" />
<variant name="bold" identifier="OpenSans-Bold" />
<variant name="extrabold" identifier="OpenSans-Extrabold" />
</font>
output:
extension UIFont {
enum OpenSans {
case light
case regular
case semibold
case bold
case extrabold
private var identifier: String {
switch self {
case .light:
return "OpenSans-Light"
case .regular:
return "OpenSans"
case .semibold:
return "OpenSans-Semibold"
case .bold:
return "OpenSans-Bold"
case .extrabold:
return "OpenSans-Extrabold"
}
}
subscript(size: CGFloat) -> UIFont {
return font(size: size)
}
func font(size: CGFloat) -> UIFont {
return UIFont(identifier, size)
}
}
}