0

Say you use ...

let x = UIImage(named: "example.jpg")

UIImage "knows" how to find the image "example.jpg"

But say you are using, for example,

let y = CGDataProvider(filename: ...)

In fact, "example.jpg" won't work. You need the full path.

What is it that UIImage#named does to convert "example.jpg" to the full path; how can we do that?

Fattie
  • 27,874
  • 70
  • 431
  • 719
  • There's actually a few existing questions that have asked this but none seem to have a proper answer. See https://stackoverflow.com/questions/22856283/use-xcassets-without-imagenamed-to-prevent-memory-problems and look at several of the "Related" questions to it as well. – HangarRash Nov 10 '22 at 15:23
  • 1
    great stuff @HangarRash TY (and great nickname :) ) – Fattie Nov 10 '22 at 17:52

0 Answers0