Apple didn't document well about how to customize the font in a Cocoa application. And here is my note while writing a digital clock application for Ling.
First of all, add the font file to Xcode and make sure that file is marked as a member of the application.
Secondly, add an entry that specifies the path to your custom font(s). By default, the custom font will be placed right under
Resources directory of the application. Thus we can add the following entry to
Finally, the custom font can be used in your application.
let textFontAttributes = [ .font: NSFont(name: "digital-7", size: 63)!, .foregroundColor: clockColor, .paragraphStyle: textStyle, ] as [NSAttributedString.Key: Any]