I'm really amazed of the new AsyncImage
view that is now available in iOS 15
. I'm currently exploring it and implemented a simple view that just loads a random image from API. But then I wanted to create that I can just refresh this AsyncImage
view on the button tap or whatever, but I have no idea how to do it as in this case URL
doesn't change I just need to refresh view
itself. I saw that there is .refreshable
modifier added in iOS 15
that marks View
as refreshable.
I don't know how to use it..
Any ideas how to reload this AsyncImage
view?
AsyncImage(url: url, scale: 1) { image in image .resizable() .aspectRatio(1, contentMode: .fit) .frame(width: 300, height: 400, alignment: .center) } placeholder: { ProgressView() .progressViewStyle(CircularProgressViewStyle(tint: .orange)) .scaleEffect(3) } .refreshable { }