There is a question about using Swift to get the dictionary keys from a PDF file here: How to get CGPDFDictionaryRef keys
An answer has been given, which is just one line of code, but I don't see how it fits with the original code in the question. Can anyone elaborate it?
Ah, yes, thanks. The line in the answer replaces the entire original code.
However, I'm still getting a bunch of hex digits, rather than actual data. But it's a step in the right direction.