Created
June 21, 2021 17:14
-
-
Save atierian/3cf8c4d93b7a5ca710163b020e568cf3 to your computer and use it in GitHub Desktop.
Two approaches to seeing installed fonts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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