diff options
| -rw-r--r-- | HoloBar/HoloBarApp.swift | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/HoloBar/HoloBarApp.swift b/HoloBar/HoloBarApp.swift index 3fb0154..eac0acd 100644 --- a/HoloBar/HoloBarApp.swift +++ b/HoloBar/HoloBarApp.swift @@ -17,9 +17,23 @@ struct HoloBarApp: App { }) { HStack { if showAvatars { - AsyncImage(url: character.avatarURL, content: { $0 }, placeholder: { - Image(systemName: "person.crop.circle") - }) + AsyncImage(url: character.avatarURL) { phase in + if let image = phase.image { + image + .resizable() + .scaledToFill() + } else if phase.error != nil { + Image(systemName: "person.crop.circle.badge.exclamationmark") + .resizable() + .scaledToFit() + .foregroundStyle(.gray) + } else { + Image(systemName: "person.crop.circle") + .resizable() + .scaledToFit() + .foregroundStyle(.gray) + } + } } Text(character.name) |