zl程序教程

您现在的位置是:首页 >  工具

当前栏目

SwiftUI iOS15 图片组件大全之带加载器的 AsyncImage

组件 图片 加载 大全 SwiftUI
2023-09-11 14:18:30 时间

实战需求

SwiftUI iOS15 图片组件大全之带加载器的 AsyncImage

本文价值与收获

看完本文后,您将能够作出下面的界面

SwiftUI iOS15 图片组件大全之带加载器的 AsyncImage

SwiftUI iOS15 图片组件大全之带加载器的 AsyncImage


实战代码

import SwiftUI
struct Restaurant: Identifiable {
    let id = UUID()
    let name: String
    let image: String
}
let restaurants = [
    Restaurant(name: "Café La Place", image: "https://images.unsplash.com/photo-1414235077428-338989a2e8c0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Nnx8cmVzdGF1cmFudHN8ZW58MHx8MHx8&auto=format&fit=crop&w=800&q=60"),
    Restaurant(name: "Joe Burger", image: "https://images.unsplash.com/p