Created
November 18, 2014 20:38
-
-
Save jbergen/f57fe6f958901900e711 to your computer and use it in GitHub Desktop.
Print all available font families and font names (Swift)
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
for family in UIFont.familyNames() { | |
let sName: String = family as String | |
println("family: \(sName)") | |
for name in UIFont.fontNamesForFamilyName(sName) { | |
println("name: \(name as String)") | |
} | |
} |
Running this code leads to a lot warnings in Xcode 13 (and maybe in earlier versions as well):
CoreText note: Client requested name ".SFUI-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Swift 4 which Xcode 9, the correct syntax is: