Rework storage structs, link preview
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user