Код: Выделить всё
AsyncImage(url: URL(string: profilImgUrl)) { phase in
switch phase {
case .empty:
ProgressView()
.scaleEffect(x: 1.5, y: 1.5, anchor: .center)
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 36)
case .success(let image):
image.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 36)
.cornerRadius(50)
case .failure:
Image(systemName: "person.circle.fill")
.resizable()
.aspectRatio(contentMode: .fit).frame(height: 36)
.cornerRadius(50)
.foregroundColor(Color.gray)
@unknown default:
Image(systemName: "person.circle.fill")
.resizable()
.aspectRatio(contentMode: .fit).frame(height: 36)
.cornerRadius(50)
.foregroundColor(Color.gray)
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... ng-failure