aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Models/FileInfo.swift
diff options
context:
space:
mode:
authorDustin Mierau <dustin@mierau.me>2023-12-19 20:38:13 -0800
committerDustin Mierau <dustin@mierau.me>2023-12-19 20:38:13 -0800
commit4fd69c02a3e7b581bb9229865336c315153f3b18 (patch)
treee6e11d872424196f2b4033077902126ad5556e40 /Hotline/Models/FileInfo.swift
parent5e87b5927cd931d46fb5f72fb035480a95969a9f (diff)
Beginnings of a UI for macOS as well as some visual changes to iOS client. :)
Diffstat (limited to 'Hotline/Models/FileInfo.swift')
-rw-r--r--Hotline/Models/FileInfo.swift10
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)
+ }
}