I've got a MacOS app I'm converting to use SwiftUI. The UI uses NSOutlineView. Is there a SwiftUI equivalent for this?
which allows code like this to be written:
Code Block swift struct FileItem: Hashable, Identifiable, CustomStringConvertible { var id: Self { self } var name: String var children: [FileItem]? = nil var description: String { switch (children) { case nil: return "📄 \(name)" case .some(let children): return children.count > 0 ? "📂 \(name)" : "📁 \(name)" } } } let data = FileItem(name: "users", children: [FileItem(name: "user1234", children: [FileItem(name:"Photos", children: [FileItem(name: "photo001.jpg"), FileItem(name: "photo002.jpg")]), FileItem(name:"Movies", children: [FileItem(name: "movie001.mp4")]), FileItem(name:"Documents", children: []) ]), FileItem(name: "newuser", children: [FileItem (name: "Documents", children: []) ]) ]) OutlineGroup(data, children: \.children) { item in Text ("\(item.description)") }