Let's get to this with Swift 4 and the accepted answer is no longer valid. The following took UIFont
and gave me a useful one CGFont
:
if let uiFont = UIFont(name: "Helvetica-Bold", size: 36.0),
let cgFont = CGFont(uiFont.fontName as CFString) {
}
source
to share