Skip to content

Instantly share code, notes, and snippets.

@popcornomnom
Created March 21, 2020 17:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#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