Skip to content

Instantly share code, notes, and snippets.

@simonbromberg
Last active January 7, 2026 12:54
Show Gist options
  • Select an option

  • Save simonbromberg/24a48fb5e94b2bde82df1e5c97e733da to your computer and use it in GitHub Desktop.

Select an option

Save simonbromberg/24a48fb5e94b2bde82df1e5c97e733da to your computer and use it in GitHub Desktop.
List all fonts available on iOS device in console
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
for (NSString *family in familyNames) {
NSLog(@"Family name: %@", family);
fontNames = [UIFont fontNamesForFamilyName: family];
for (NSString *font in fontNames) {
NSLog(@" Font name: %@", font);
}
}
let familyNames = UIFont.familyNames
for family in familyNames {
print("Family name " + family)
let fontNames = UIFont.fontNames(forFamilyName: family)
for font in fontNames {
print(" Font name: " + font)
}
}
@kasperkronborg
Copy link

You are missing a type declaration for fontNames in ListFonts.m

NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
  
for (NSString *family in familyNames) {
  NSLog(@"Family name: %@", family);

  NSArray *fontNames = [UIFont fontNamesForFamilyName: family];
  for (NSString *font in fontNames) {
    NSLog(@"    Font name: %@", font);
  }
}

@steven-pearson
Copy link

For anyone using C# and MAUI

            var familyNames = UIFont.FamilyNames;

            foreach (var family in familyNames)
            {
                Console.WriteLine($"Family name: {family}");

                var fontNames = UIFont.FontNamesForFamilyName(family);
                foreach (var fontName in fontNames)
                {
                    Console.WriteLine($"    Font name: {fontName}");
                }
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment