美文网首页
异步加载图片

异步加载图片

作者: 上帝死了众神在堕落 | 来源:发表于2022-06-16 14:11 被阅读0次
AsyncImage(url: URL(string: breed.image!.url!)) { phase in
                    if let image = phase.image {
                        image.resizable()
                            .scaledToFill()
                            .frame(width: imageSize, height: imageSize)
                            .clipped()
                        
                     } else if phase.error != nil {
                         
                         Text(phase.error?.localizedDescription ?? "error")
                             .foregroundColor(Color.pink)
                             .frame(width: imageSize, height: imageSize)
                     } else {
                        ProgressView()
                             .frame(width: imageSize, height: imageSize)
                     }
                    
                }

相关文章

网友评论

      本文标题:异步加载图片

      本文链接:https://www.haomeiwen.com/subject/tikqvrtx.html