Skip to content

Instantly share code, notes, and snippets.

@atierian
Created June 21, 2021 17:14
Show Gist options
  • Select an option

  • Save atierian/3cf8c4d93b7a5ca710163b020e568cf3 to your computer and use it in GitHub Desktop.

Select an option

Save atierian/3cf8c4d93b7a5ca710163b020e568cf3 to your computer and use it in GitHub Desktop.
Two approaches to seeing installed fonts
import UIKit
import PlaygroundSupport
// Print fonts
extension UIFont {
public static func printAllFonts() {
for family in UIFont.familyNames.sorted() {
let names = UIFont.fontNames(forFamilyName: family)
print("Family: \(family)")
names.forEach {
print("- " + $0)
}
print("~~~~~~")
}
}
}
UIFont.printAllFonts()
// Font Picker Controller
let config = UIFontPickerViewController.Configuration()
config.includeFaces = true
let fontPickerViewController = UIFontPickerViewController(configuration: config)
PlaygroundPage.current.liveView = fontPickerViewController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment