2022-12-11 05:21:21 +05:30
|
|
|
import SDWebImageSwiftUI
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ThumbnailView: View {
|
|
|
|
var url: URL?
|
2022-12-13 17:43:58 +05:30
|
|
|
private let thumbnails = ThumbnailsModel.shared
|
2022-12-11 05:21:21 +05:30
|
|
|
|
|
|
|
var body: some View {
|
2022-12-11 18:30:46 +05:30
|
|
|
WebImage(url: url)
|
|
|
|
.resizable()
|
|
|
|
.onFailure { _ in
|
|
|
|
if let url {
|
|
|
|
thumbnails.insertUnloadable(url)
|
2022-12-11 17:08:57 +05:30
|
|
|
}
|
2022-12-11 05:21:21 +05:30
|
|
|
}
|
2022-12-11 18:30:46 +05:30
|
|
|
.placeholder {
|
|
|
|
Rectangle().fill(Color("PlaceholderColor"))
|
2022-12-11 17:08:57 +05:30
|
|
|
}
|
2022-12-11 05:21:21 +05:30
|
|
|
}
|
|
|
|
}
|