我正在尝试显示来自 Firebase 的 Int 数组,但我一直收到错误,我不知道为什么

I am trying to display an array of Int from Firebase but I keep getting an error and I am not sure why

提问人:Bobby 提问时间:11/7/2023 最后编辑:soundflixBobby 更新时间:11/9/2023 访问量:30

问:

List {
    ForEach(0..<tables.count, id: \.self) { item in
        Text("Table \(tables[tableNumber ?? 0].items): \(tables[item].items.formatted())")
    }
}

我以为这段代码会显示已经从Firebase收集的数据,如这个例子,表6:汉堡。 但相反,我收到了这个错误:

实例方法“appendInterpolation(_:formatter:)”要求“[String]”继承自“NSObject”

数组 firebase list swiftui foreach

评论

1赞 jnpdx 11/7/2023
欢迎来到 SO。请阅读如何询问需要哪些调试信息。此外,不应与索引一起使用。使用数据ForEachIdentifiable
0赞 soundflix 11/7/2023
“example, Table 6: Burger”没有链接。您可以编辑以添加链接。

答: 暂无答案