yattee/Shared/Videos/ThumbnailView.swift

21 lines
488 B
Swift
Raw Normal View History

2022-12-10 23:51:21 +00:00
import SDWebImageSwiftUI
import SwiftUI
struct ThumbnailView: View {
var url: URL?
2022-12-11 13:00:46 +00:00
@ObservedObject private var 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-10 23:51:21 +00:00
}
2022-12-11 13:00:46 +00:00
.placeholder {
Rectangle().fill(Color("PlaceholderColor"))
}
2022-12-10 23:51:21 +00:00
}
}