Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot convert value of type 'CFString' to expected argument type 'UnsafePointer<Void>' (aka 'UnsafePointer<()>')

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<()>')

like image 214
Aryan Kashyap Avatar asked Oct 20 '25 11:10

Aryan Kashyap


1 Answers

Try

let runFont = unsafeBitCast(CFDictionaryGetValue(CTRunGetAttributes(run), unsafeBitCast(kCTFontAttributeName, UnsafePointer<Void>.self)), CTFontRef.self)
like image 200
vadian Avatar answered Oct 23 '25 04:10

vadian