Add tag overview, improve assets
This commit is contained in:
55
CHDataManagement/Model/Item/Item.swift
Normal file
55
CHDataManagement/Model/Item/Item.swift
Normal file
@@ -0,0 +1,55 @@
|
||||
import Foundation
|
||||
|
||||
class Item: ObservableObject, Identifiable {
|
||||
|
||||
unowned let content: Content
|
||||
|
||||
@Published
|
||||
var id: String
|
||||
|
||||
init(content: Content, id: String) {
|
||||
self.content = content
|
||||
self.id = id
|
||||
}
|
||||
|
||||
func makeCleanAbsolutePath(_ path: String) -> String {
|
||||
"/" + makeCleanRelativePath(path)
|
||||
}
|
||||
|
||||
func makeCleanRelativePath(_ path: String) -> String {
|
||||
path.components(separatedBy: "/").filter { !$0.isEmpty }.joined(separator: "/")
|
||||
}
|
||||
|
||||
func title(in language: ContentLanguage) -> String {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
func absoluteUrl(in language: ContentLanguage) -> String {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
var itemType: ItemType {
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
|
||||
extension Item: Equatable {
|
||||
|
||||
static func == (lhs: Item, rhs: Item) -> Bool {
|
||||
lhs.id == rhs.id
|
||||
}
|
||||
}
|
||||
|
||||
extension Item: Hashable {
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(id)
|
||||
}
|
||||
}
|
||||
|
||||
extension Item: Comparable {
|
||||
|
||||
static func < (lhs: Item, rhs: Item) -> Bool {
|
||||
lhs.id < rhs.id
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user