user6168494
user6168494

Reputation:

Creating CGPDFDocument from a URL yields errors in Swift 3?

The below block of code yields these two errors when I try to build. Can anybody help me out? Xcode 8 had its way with my project using its migrator and I haven't seen this error before.

    let url = URL(string: "http://www.google.com")!;
    var pdf:CGPDFDocument = CGPDFDocument(url);
  1. error: cannot invoke initializer for type 'CGPDFDocument' with an argument list of type '(URL)'
  2. note: overloads for 'CGPDFDocument' exist with these partially matching parameter lists: (CGDataProvider), (CFURL)

Upvotes: 2

Views: 1755

Answers (1)

Durul Dalkanat
Durul Dalkanat

Reputation: 7415

Hello it should like this below.

let url = URL(string: "http://www.google.com")!
fileprivate var pdfDoc: CGPDFDocument
pdfDoc = CGPDFDocument(url as CFURL)!

Upvotes: 3

Related Questions