diff options
Diffstat (limited to 'Hotline/Models/FileInfo.swift')
| -rw-r--r-- | Hotline/Models/FileInfo.swift | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Hotline/Models/FileInfo.swift b/Hotline/Models/FileInfo.swift index 0e2c76d..5976b8f 100644 --- a/Hotline/Models/FileInfo.swift +++ b/Hotline/Models/FileInfo.swift @@ -1,7 +1,7 @@ import SwiftUI -@Observable class FileInfo: Identifiable { - let id: UUID = UUID() +@Observable class FileInfo: Identifiable, Hashable { + let id: UUID let path: [String] let name: String @@ -11,9 +11,11 @@ import SwiftUI let fileSize: UInt let isFolder: Bool + var expanded: Bool = false var children: [FileInfo]? = nil init(hotlineFile: HotlineFile) { + self.id = UUID() self.path = hotlineFile.path self.name = hotlineFile.name self.type = hotlineFile.type @@ -28,4 +30,8 @@ import SwiftUI static func == (lhs: FileInfo, rhs: FileInfo) -> Bool { return lhs.id == rhs.id } + + func hash(into hasher: inout Hasher) { + hasher.combine(self.id) + } } |