Swiftui asyncimage - попробуйте еще раз при сбое загрузки изображенияIOS

Программируем под IOS
Гость
Swiftui asyncimage - попробуйте еще раз при сбое загрузки изображения

Сообщение Гость »

Код: Выделить всё

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)
}
case .failure получается довольно часто, даже если Profilimgurl является 100% действительным. Если нет, то какой обходной путь я могу сделать?

Подробнее здесь: https://stackoverflow.com/questions/795 ... ng-failure

Вернуться в «IOS»