Here is the CollectionItem model:
@available(iOS 26, *)
@Model final class CollectionItem: Item {
var name: String
var icon: String?
init(
name: String,
icon: String? = nil,
parent: CollectionItem? = nil,
timestamp: Date = .now
) {
self.name = name
self.icon = icon
super.init(parent: parent)
}
}
Do you really need such a complex solution?
I'm not sure, what I want is to mix CollectionItem and LinkItem. Collections can have children, Links cannot.
It's like a file system where a directory can have directories or files.
So yeah it's a bit complex but this might not be that exotic.
There is probably a better way to design this…
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: