Posts

Post not yet marked as solved
2 Replies
347 Views
I'm trying to create PDF files using UIGraphicsRenderer. While trying out the code from this tutorial - https://developer.apple.com/documentation/uikit/uigraphicspdfrenderer, I encountered the above error when trying to call the pdfData method. The code(almost identical to the one in the tutorial) is reproduced below, with the error found at line 12. Is the .pdfData method somehow missing, or am I doing something wrong? class UIGraphicsPDFRenderer : UIGraphicsRenderer { } var rendererformat = UIGraphicsPDFRendererFormat() var renderer = UIGraphicsPDFRenderer() """Drawing the PDF""" let pdf = renderer.pdfData() { (context) in   context.beginPage()   let attributes = [     NSFontAttributeName : UIFont.boldSystemFont(ofSize: 150)   ]   let text = "Hello!" as NSString   text.draw(in: CGRect(x: 0, y: 0, width: 500, height: 200), withAttributes: attributes) }
Posted
by m6add11.
Last updated
.