Last active
June 22, 2021 22:25
-
-
Save soffes/691ea4bc6b6e194b8ef181f534a7215f to your computer and use it in GitHub Desktop.
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
| import UIKit | |
| extension UIFont { | |
| func withMonospacedNumbers() -> Self { | |
| let fontDescriptor = UIFontDescriptor(name: fontName, size: pointSize).addingAttributes([ | |
| .featureSettings: [ | |
| [ | |
| UIFontDescriptor.FeatureKey.featureIdentifier: kNumberSpacingType, | |
| UIFontDescriptor.FeatureKey.typeIdentifier: kMonospacedNumbersSelector | |
| ] | |
| ] | |
| ]) | |
| return Self(descriptor: fontDescriptor, size: pointSize) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment