Created
November 27, 2023 05:44
-
-
Save yccheok/ce0f516626e31ccda36d65552e6ade42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getFont(_ textSize: Int) -> UIFont { | |
switch self { | |
case .new_york: | |
let sfFont = UIFont.systemFont(ofSize: CGFloat(textSize)) | |
var fontDescriptor = sfFont.fontDescriptor | |
fontDescriptor = fontDescriptor.withSymbolicTraits(.traitBold) ?? fontDescriptor | |
if let newYorkFontDescriptor = fontDescriptor.withDesign(.serif) { | |
let newYorkFont = UIFont(descriptor: newYorkFontDescriptor, size: 0.0) | |
return newYorkFont | |
} else { | |
return sfFont | |
} | |
case .san_francisco: | |
let sfFont = UIFont.boldSystemFont(ofSize: CGFloat(textSize)) | |
return sfFont |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment