Is it ok to use
session.data(from: url) instead of
session.download(from: url) and omit the check at the end? Or is there an advantage to safe the image first?
There should be no major difference between the two implementations.
You could call
session.data(from: url), check the response first, and then attempt to save the image to temporary (or permanent) storage.
Alternatively, the video. uses
session.download(from: url) which conveniently saves it for you to temporary storage along with providing the response to check how things went.
Both implementations are perfectly fine and should work the same, so whichever you prefer is ok