I am receiving an Image from my server with a post request using URLRequest
.
I noticed that the AsyncImage
view as for now, does not support a URLRequest
as an input.
As for now, I have 2 options in mind:
- Using
UIImage(data:)
- Building a custom AsyncImage something like in this link: https://www.donnywals.com/using-swifts-async-await-to-build-an-image-loader/
Are these really the only alternatives or perhaps I’m missing something?
3
Answers
You can download asyncImage with URL String Exemple:
You can use the
.task()
modifier to your image in your view, like this:It will work for iOS 15 on.
I would personally build a custom one with your needs.
I’ve recently tried it to get more in touch with combine publishers and it’s quite simple to get something decent, if you want to try/contribute/take it as example, feel free: Simple iOS 13 AsyncImage