Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

29 Commits

Repository files navigation

Article related to this project


AsyncImage

The project demonstrates how to load images asynchronously in SwiftUI.

Usage:

// Image URLs to load
letposters=["https://image.tmdb.org/t/p/original/pThyQovXQrw2m0s9x82twj48Jq4.jpg","https://image.tmdb.org/t/p/original/vqzNJRH4YyquRiWxCCOH0aXggHI.jpg","https://image.tmdb.org/t/p/original/6ApDtO7xaWAfPqfi2IARXIzj8QS.jpg","https://image.tmdb.org/t/p/original/7GsM4mtM0worCtIVeiQt28HieeN.jpg"].map{URL(string: $0)! }structContentView:View{varbody:someView{List(posters, id: \.self){ url inAsyncImage(
url: url,
placeholder:{Text("Loading ...")},
image:{Image(uiImage: $0).resizable()}).frame(idealHeight:UIScreen.main.bounds.width /2*3) // 2:3 aspect ratio
}}}

Result:

How to load image from URL asynchronously in SwiftUI

About

Asynchronous Image Loading from URL in SwiftUI

Topics

Resources

Stars

277 stars

Watchers

10 watching

Forks

Releases

Packages

Contributors

Languages