Save automatically, improve mocks
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import Foundation
|
||||
import Combine
|
||||
|
||||
class Item: ObservableObject, Identifiable {
|
||||
class Item: ObservableContentItem, Identifiable {
|
||||
|
||||
unowned let content: Content
|
||||
|
||||
@ -11,17 +12,25 @@ class Item: ObservableObject, Identifiable {
|
||||
@Published
|
||||
var id: String
|
||||
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
|
||||
init(content: Content, id: String) {
|
||||
self.content = content
|
||||
self.id = id
|
||||
|
||||
observeChanges()
|
||||
}
|
||||
|
||||
// MARK: Change observation
|
||||
|
||||
func didChange() {
|
||||
DispatchQueue.main.async {
|
||||
self.changeToggle.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Paths
|
||||
|
||||
func makeCleanAbsolutePath(_ path: String) -> String {
|
||||
"/" + makeCleanRelativePath(path)
|
||||
}
|
||||
|
@ -9,3 +9,7 @@ struct ItemId {
|
||||
extension ItemId: Codable {
|
||||
|
||||
}
|
||||
|
||||
extension ItemId: Equatable {
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user