Post

Replies

Boosts

Views

Activity

[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?
1
0
972
Jun ’21