i’ve subject with objects.I’ve fashions
@Mannequin
class Tag {
var id: UUID
var title: String = ""
var coloration: Int = 0xFFFFFF
init( title: String, coloration: Int ) {
self.id = UUID()
self.title = title
self.coloration = coloration
}
}
@Mannequin
class Process {
var id: UUID = UUID()
var title: String = ""
var tags: [Tags] = []
init(title: String, tags: [Tags] = [] ) {
self.title = title
self.tags = tags
}
}
i choose tags earlier than create activity with @State non-public var selectedTags: [Tags] = []
than i create activity with tags
let newTask = Process(
title: taskTitle,
tags: allTags
)
selectedList!.duties.append(newTask)
strive? modelContext.save()
once I create a number of duties with the identical tag, at first all the things is ok, but when I reload the applying, the tag stays within the final added activity and all different tags are deleted.I don’t perceive why the identical tag can’t be in a number of duties.