mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 22:00:31 +05:30
26 lines
511 B
Swift
26 lines
511 B
Swift
|
import Foundation
|
||
|
|
||
|
final class ThumbnailsModel: ObservableObject {
|
||
|
@Published var unloadable = Set<URL>()
|
||
|
|
||
|
func insertUnloadable(_ url: URL) {
|
||
|
unloadable.insert(url)
|
||
|
}
|
||
|
|
||
|
func isUnloadable(_ url: URL!) -> Bool {
|
||
|
guard !url.isNil else {
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
return unloadable.contains(url)
|
||
|
}
|
||
|
|
||
|
func loadableURL(_ url: URL!) -> URL? {
|
||
|
guard !url.isNil else {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
return isUnloadable(url) ? nil : url
|
||
|
}
|
||
|
}
|