36 lines
658 B
Swift
36 lines
658 B
Swift
import Foundation
|
|
|
|
final class FileResource: ObservableObject {
|
|
|
|
/// Globally unique id
|
|
@Published
|
|
var uniqueId: String
|
|
|
|
@Published
|
|
var description: String
|
|
|
|
init(uniqueId: String, description: String) {
|
|
self.uniqueId = uniqueId
|
|
self.description = description
|
|
}
|
|
}
|
|
|
|
extension FileResource: Identifiable {
|
|
|
|
var id: String { uniqueId }
|
|
}
|
|
|
|
extension FileResource: Equatable {
|
|
|
|
static func == (lhs: FileResource, rhs: FileResource) -> Bool {
|
|
lhs.uniqueId == rhs.uniqueId
|
|
}
|
|
}
|
|
|
|
extension FileResource: Hashable {
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
hasher.combine(uniqueId)
|
|
}
|
|
}
|