Rework storage structs, link preview

This commit is contained in:
Christoph Hagen
2025-01-08 14:59:04 +01:00
parent b99c064d10
commit a7197b9628
75 changed files with 1365 additions and 1454 deletions

View File

@@ -39,12 +39,20 @@ class Item: ObservableObject, Identifiable {
var itemType: ItemType {
fatalError()
}
var itemReference: ItemReference {
fatalError()
}
var itemId: ItemId {
.init(type: itemType, id: id)
}
}
extension Item: Equatable {
static func == (lhs: Item, rhs: Item) -> Bool {
lhs.id == rhs.id
lhs.id == rhs.id && lhs.itemType == rhs.itemType
}
}
@@ -52,12 +60,13 @@ extension Item: Hashable {
func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(itemType)
}
}
extension Item: Comparable {
static func < (lhs: Item, rhs: Item) -> Bool {
lhs.id < rhs.id
lhs.id < rhs.id && lhs.itemType < rhs.itemType
}
}