I'm trying to create a CoreGraphics Context using the following MacOS Quartz API:
CGContext.init?(_ url: CFURL,
mediaBox: UnsafePointer<CGRect>?,
_ auxiliaryInfo: CFDictionary?)
, but I'm having trouble with the concept of pointers. I can initiate the context thus:
var mypointer: UnsafeMutablePointer<CGRect>!
mypointer.pointee = myCGRectangle
var writeContext = CGContext.init(outURL, mediaBox: mypointer, nil)
But it says that pointee
is a get-only property. I've tried:
var mypointer: UnsafePointer<CGRect>! = UnsafePointer(myCGRectangle)
, based on this, but I get cannot convert CGRect to expected type
, amongst other errors.
I have looked at several other questions here about pointers, but I can't find anything useful within them.