Error in Hierarchical Table or list in MAC OS but not iOS

If I use the example code I find in the Quick help for LIST (Creating hierarchical lists) in MAC OS 15.1, I get an error, but not in IOS 18.1. The error happens when I try to Compact any Item I had expanded. If I use a table instead I also get an error, But If I use outline group without list there is not error

struct ContentView: View {
    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.isEmpty ? "📂 \(name)" : "📁 \(name)"
            }
        }
    }
    let fileHierarchyData: [FileItem] = [
      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: [])
           ])
        ]),
        FileItem(name: "private", children: nil)
    ]
    var body: some View {
        List(fileHierarchyData, children: \.children) { item in
            Text(item.description)
        }
    }
}

hi @RicMarlop ,

Can you please tell me which Xcode version you are testing one? (https://developer.apple.com/download/applications/ from this site, like Xcode beta 6 for example).

Also, what version is your Mac on? If you go to General -> About, there should be a long number next to 15.1 beta.

Thanks, Sydney

Error in Hierarchical Table or list in MAC OS but not iOS
 
 
Q