Skip to content

Instantly share code, notes, and snippets.

@bennokress
Created April 22, 2020 09:59
Show Gist options
  • Save bennokress/199fd13e1bfa4cf6b0364ae1fd1f0ec8 to your computer and use it in GitHub Desktop.
Save bennokress/199fd13e1bfa4cf6b0364ae1fd1f0ec8 to your computer and use it in GitHub Desktop.
Extensions for Swift's UIFont Type.
import UIKit
extension UIFont {
/// Prints all fonts that can be used with `UIFont(name:, size:)` to the console.
static func printAllAvailableFontNames() {
for familyName in UIFont.familyNames {
print("\n\(familyName)")
for fontName in UIFont.fontNames(forFamilyName: familyName) {
print("\t- \(fontName)")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment