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