0

I'm developing a pdf parser in swift, so i've stumbled upon the function CGPDFScannerPopString which takes a CGPDFScannerRef and an UnsafeMutablePointer?

The Objective C code looks like this:

CGPDFStringRef pdfString;
CGPDFScannerPopString(pdfScanner, &pdfString);

How do I write this in swift 3?

1 Answers1

0

The type of the second parameter of CGPDFScannerPopString is UnsafeMutablePointer<CGPDFStringRef?>?. So, you need to prepare a variable of type CGPDFStringRef? and pass it as an inout argument:

var pdfString: CGPDFStringRef?
_ = CGPDFScannerPopString(pdfScanner, &pdfString)
OOPer
  • 47,149
  • 6
  • 107
  • 142
  • that's what I tried at first, however there's a couple of errors showing up telling me that there's an extra argument in call and that an expression is expected in list of expressions... – Michael Schmid Dec 11 '16 at 16:56
  • 1
    @MichaelSchmid, the code above compiles without any problems in my Xcode 8.1. If you have found such errors, some other things may be affecting. You should show whole code which can reproduce your issue. – OOPer Dec 11 '16 at 17:01
  • sorry I missed a parenthese... long day already thanks for the help – Michael Schmid Dec 11 '16 at 17:11
  • That may happen. Take some rest (I hope you can...). Good luck. – OOPer Dec 11 '16 at 17:15