Skip to content

Instantly share code, notes, and snippets.

@popcornomnom
Created March 21, 2020 17:46
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 popcornomnom/a677d549aa216b071ac92d336557c63b to your computer and use it in GitHub Desktop.
Save popcornomnom/a677d549aa216b071ac92d336557c63b to your computer and use it in GitHub Desktop.
#if DEBUG
extension UIFont.Size {
var debugDescription: String { "\(self)" }
}
extension UIFont {
class func printAllFonts() {
let families = UIFont.Family.allCases
let sizes = UIFont.Size.allCases
let weights = UIFont.CustomWeight.allCases
let string = families.map { family in
"\(family.rawValue):" + sizes.map { size in
"\n\t\(size.debugDescription):\n\t\t" + weights.map { weight in
"\(UIFont(family, size, weight))"
}.joined(separator: "\n\t\t")
}.joined(separator: "\n")
}.joined(separator: "\n")
print(string)
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment