Skip to content

Instantly share code, notes, and snippets.

@robinkunde
Created August 21, 2019 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinkunde/19e468a5b8a42ad8d40e25df3c7d892e to your computer and use it in GitHub Desktop.
Save robinkunde/19e468a5b8a42ad8d40e25df3c7d892e to your computer and use it in GitHub Desktop.
Print certain font names
for familyName in UIFont.familyNames.sorted() {
var hasPrintedFamilyName = false
for fontName in UIFont.fontNames(forFamilyName: familyName).sorted() {
let font = UIFont(name: fontName, size: 16.0)!
guard font.fontDescriptor.symbolicTraits.contains(.traitMonoSpace) else { continue }
if !hasPrintedFamilyName {
print(familyName)
hasPrintedFamilyName = true
}
print(" " + fontName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment