SwiftUI_visionOS_Note

AsyncImage

May 7, 2024

Asynchronously download image from URL

  • From internet to the device
 
 

When the view appear, AsyncImage will read the data and put it inside the container. It will fetch the data every time we run the view.

 

Image is bigger than the frame size, so other outside part will be cut off.

 
 

We can use url, content and placeholder to modify the image

 

Now returnedImage can use the modifier properly just like Image()

 
 

Phase completion

 

AsyncImagePhage has an empty, success and failure state.

if url string is empty, it will show progressView(), else successful, it will return the Image, else it fails will show the question mark

 

You might also like

BlogPro logo
Made with BlogPro