I\'m trying to use CTFontCreatePathForGlyph(font: CTFont?, glyph: CGGlyph, transform: CConstPointer
:
let myFont = CTFontCr
The simplest solution is using withUnsafePointer
function:
let myFont = CTFontCreateWithName("Helvetica", 12, nil)
let myGlyph = CTFontGetGlyphWithName(myFont, "a")
var myTransform = CGAffineTransformIdentity
var path = withUnsafePointer(&myTransform) { (pointer: UnsafePointer<CGAffineTransform>) -> (CGPath) in
return CTFontCreatePathForGlyph(myFont, myGlyph, pointer)
}
The initialize
is not a constructor. You would have to alloc
a new memory using UnsafePointer<T>.alloc
, then initialize
and then dealloc
. Function withUnsafePointer
does that all for you.
Note that myTransform
cannot be a constant (var
not let
) otherwise you cannot use it for an inout
param (&myTransform
).