diff options
| author | Fuwn <[email protected]> | 2025-02-12 21:41:09 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-02-12 21:41:09 -0800 |
| commit | d70954016a2ea2fb903d75e28161bf473307215e (patch) | |
| tree | 54616c4090076e12a3784bfde4b2e0c106331c0c | |
| parent | feat(CharacterFetcher): Track raw name and affiliation (diff) | |
| download | holobar-d70954016a2ea2fb903d75e28161bf473307215e.tar.xz holobar-d70954016a2ea2fb903d75e28161bf473307215e.zip | |
feat(HoloBarApp): Add more avatar fallback levels
| -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) |