I'm using Swift 5 and Xcode 11.4.1 on macOS Catalina.
I have had no problem applying custom font til today. I'm trying to apply custom font to a label called "textLabel". Let me show you how I tried first and then please tell me what is wrong.
- By Using Storyboard
- I want to use custom font whose name is "myFont.ttf" to a label called "textLabel".
- I dropped the font file in Xcode with this option.

- I went to info.plist to let Xcode know that I provide custom font.

- I opened the main.storyboard, went to attribute inspectors and chose the label's font as custom style.
- I can't find "myFont" font in the font family list. << The problem here.
So I tried another way, programmatically.
- By Using Code
- Same process as mentioned above until the number 3.
- I wrote this code inside of viewController.swift file.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var textLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
textLabel.font = UIFont(name: "myFont.ttf", size: 22)
}
}
- I ran the app, It shows just normal system font.
I tried both ways over and over (even I created new files for 5 times to just test this font thing)and also I tried with various fonts but same thing happened.