Logging the custom fonts in an iOS app

I almost always add custom fonts to an app project, as they are an integral part of my UI design and maintaining that aesthetic throughout the app is (to me) the sign of a quality app.

But...it's also usually difficult to determine if the font you added is actually available (after modifying the info.plist file). In code, we need to use the exact "official" name for iOS to be able to use it.

So here's a code snippet to log all the fonts available to the console. It helps me when trying to debug a custom font issue:

var fontFamilies:NSArray = UIFont.familyNames()

for var i = 0; i < fontFamilies.count; ++i
{
var fontFamily: NSString = fontFamilies.objectAtIndex(i) as! NSString;
var fontNames: NSArray = UIFont.fontNamesForFamilyName(fontFamilies.objectAtIndex(i) as! String)
println("\(fontFamily)\(fontNames)")
}