Hello!
I'm creating a project to quickly create views in my project. But for some reason, when I try to create an image with a pdf resource it's not working. Playgrounds and PDF resources are not compatible?
any clue?
thanks in advance!
How are you creating the image? iOS’s PDF support is a lot more limited than macOS’s. So, for example, if you create an iOS app and add
test.pdf
resource to it, code like this:
let pdfURL = Bundle.main.url(forResource: "test", withExtension: "pdf")!
let image = UIImage(contentsOfFile: pdfURL.path)
print(image)
prints
nil
because UIImage doesn’t support reading from PDF directly.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"