struct NetworkImage: View {
let url: URL?
var body: some View {
Group {
if let url = url, let imageData = try? Data(contentsOf: url),
let uiImage = UIImage(data: imageData) {
Image(uiImage: uiImage)
.resizable()
}
else {
Image("league")
}
}
}
}
NetworkImage(url: URL(string: context.attributes.imageGame))
.aspectRatio(contentMode: .fill)
.frame(width: 35, height: 35)
.clipShape(Circle())