Create a new single view app
Create a group in your app named Fonts, drop in your font files (tick copy files if needed).
In info.plist, add "Fonts provided by application", add each item for each font eg, item 0: AlexBrush-Regular.ttf, item 1: Fipps-Regular.otf
Or edit info.plist directly:
<key>UIAppFonts</key>
<array>
<string>AlexBrush-Regular.ttf</string>
<string>Fipps-Regular.otf</string>
</array>
Cut and paste this swift 5 code into ViewController.swift, run in a simulator, add a filter in the console log using your font name
//
// ViewController.swift
// FontsApp
//
// Created by Gary Davies on 28/3/19.
// Copyright © 2019 Gary Davies. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
var fontFamilyNames: [String] = []
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
fontNames()
}
func fontNames() {
getFontNames()
sortFontNames()
printFontName()
}
func getFontNames() {
fontFamilyNames.removeAll()
for name in UIFont.familyNames {
fontFamilyNames.append(name)
}
}
func sortFontNames() {
let sorted = fontFamilyNames.sorted { $0.localizedCaseInsensitiveCompare($1) == ComparisonResult.orderedAscending }
fontFamilyNames.removeAll()
for name in sorted {
fontFamilyNames.append(name)
}
}
func printFontName() {
for name in fontFamilyNames {
print(name, "=>", UIFont.fontNames(forFamilyName: name))
}
}
}
(Sorry this is not a duplicate, I added the wrong answer to the wrong question)