I am getting a build error, when I define the line
let runFont : CTFontRef = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName)
And the error is: Cannot convert value of type 'CFString' to expected argument type 'UnsafePointer' (aka 'UnsafePointer<()>')
Try
let runFont = unsafeBitCast(CFDictionaryGetValue(CTRunGetAttributes(run), unsafeBitCast(kCTFontAttributeName, UnsafePointer<Void>.self)), CTFontRef.self)