4

Since you can create vector image assets in Xcode with PDFs and SVGs, is it possible to download a PDF/SVG from a remote url (storage) and create a vector UIImage from that? I want to avoid having multiple sizes of the same picture stored, but am unsure if its possible to create a vector resource from a remote download.

let image = UIImage(data: [*download_data*])

nick
  • 107
  • 4
  • Once you initialize an UIImage it is not a vector anymore. – Leo Dabus Dec 29 '20 at 22:59
  • Check this answer: https://stackoverflow.com/a/45706892/921573 - there is no built-in support for rendering svg in iOS (except with a WebView). You would have to parse and draw the svg yourself or using a library. – de. Dec 30 '20 at 11:53
  • 1
    A UIImage initialized from a PDF image asset marked with "Preserve Vector Data" appears to still be a vector image. Is there any other way to initialize such a UIImage? – Sebastian Kirsche Apr 22 '22 at 11:06
  • "Once you initialize an UIImage it is not a vector anymore. " <<<< In the asset catalogue, click "Preserve Vector Data" and it seems that UIImage can indeed be rescaled even after initializing one from a PDF vector - without losing quality. – Jonny Apr 11 '23 at 09:35

0 Answers0