I want to transform a CGPath with the transform CGAffineTransformMakeRotation(radians)
but the CGPathCreateCopyByTransformingPath
func takes a CConstPointer<CGAffineTransform>
. How do I get a CConstPointer<CGAffineTransform>
out of my CGAffineTransform
?
Pass the CGAffineTransform as an inout expression (that is, prefix it with &
).
var xform = CGAffineTransformMakeRotation(3)
let newPath = CGPathCreateCopyByTransformingPath(originalPath, &xform)
Note that the transform must be a variable, not a Swift constant (declared with let
).
c.f. Using Swift with Cocoa and Objective-C: Interacting with C APIs