Created
December 20, 2021 21:39
-
-
Save iSapozhnik/56260c43b2e56951b9cd12d712eb04cb to your computer and use it in GitHub Desktop.
Rounded NSFont
This file contains hidden or 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
extension NSFont { | |
class func roundedFont(ofSize size: CGFloat, weight: NSFont.Weight) -> NSFont { | |
let systemFont = NSFont.systemFont(ofSize: size, weight: weight) | |
guard let descriptor = systemFont.fontDescriptor.withDesign(.rounded), | |
let roundedFont = NSFont(descriptor: descriptor, size: size) else { | |
return systemFont | |
} | |
return roundedFont | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment