项目
在 GitHub 查看
V8tr/AsyncImage
关于
Asynchronous Image Loading from URL in SwiftUI
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Article related to this project
AsyncImage
The project demonstrates how to load images asynchronously in SwiftUI.
Usage:
// Image URLs to load
let posters = [
"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)! }
struct ContentView: View {
var body: some View {
List(posters, id: \.self) { url in
AsyncImage(
url: url,
placeholder: { Text("Loading ...") },
image: { Image(uiImage: $0).resizable() }
)
.frame(idealHeight: UIScreen.main.bounds.width / 2 * 3) // 2:3 aspect ratio
}
}
}
Result:
探索相关项目
加载中…