Created
October 19, 2017 15:33
-
-
Save max-potapov/c6a8cd1b85df89e65ec5f35dada56b01 to your computer and use it in GitHub Desktop.
Swift 4: UIFont small caps extension
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
extension UIFont { | |
func smallCapsFont() -> UIFont { | |
let attributes: [UIFontDescriptor.FeatureKey: Any] = [ | |
.featureIdentifier: kLowerCaseType, | |
.typeIdentifier: kLowerCaseSmallCapsSelector | |
] | |
let descriptor = fontDescriptor.addingAttributes([ | |
.featureSettings: [attributes], | |
.name: fontName | |
]) | |
return UIFont(descriptor: descriptor, size: pointSize) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment