[SwiftUI] How do I catch the "No image named MYEXAMPLE found in asset catalog" warning? Alternatively, how do I determine if something exists in the asset catalog?

I'm trying to store image data locally and the name of the image is retrieved from an API. In the situation where an image does not exist locally, I want to put a placeholder. Right now it just puts a white background.

Whenever I retrieve from the API I get a purple exclamation which is a warning but not an exception. How can I intercept this warning and make it show a placeholder instead?

One problem is that Image is not an optional. It just blithely accepts whatever is fed into it which is annoying. Is there a way to query the asset catalog if it contains something?

I've stumbled upon this question too, and for now I found the only way to handle this issue by using Image(uiImage: UIImage(named: ....)) init. You can check if UIImage(named: ....) exists because it's optional.

[SwiftUI] How do I catch the "No image named MYEXAMPLE found in asset catalog" warning? Alternatively, how do I determine if something exists in the asset catalog?
 
 
Q