我有以下可识别的数据。我想做的是我也想添加一个type
,view
以便稍后我可以提供一个Button
链接到这些视图的链接。我不知道如何做到这一点。它说它不接受视图类型。
我的目标是制作卡片,每张卡片都会保存Datum
价值。我想为Button
它们中的每一个设置一个,将用户带到该特定视图。因为我做了一个ForEach
,我希望能够添加每个Datum
的视图。我做了以下但swift不接受它并抛出错误。
这是代码:
struct Datum:Identifiable {
var id = UUID()
var subtitle:String
var name:String
var footnote: String
var description:String
var image:String
var categoryTag:String
var comingSoon:Bool
//var modelName: **View**
}
public var categoriesList = ["DL", "TSA", "NLP"]
var ModelsData:[Datum] = [
Datum(subtitle: "Deep Learning",
name: "Mask Detection",
footnote: "An image classificaton model.",
description: "This model classifies whether a person has a mask or not. You simply take your camera and then take your face. Then, it will go and scan it. After that, you will see that at the bottom it shows green (means you have a mask) or red (which means you dont have a mask.)",
image: "MaskDetectionImage",
categoryTag: "DL",
comingSoon: false,
//modelName: MaskDetectionView()), //I want to add a view
Datum(subtitle: "Deep Leaning",
name: "Video games",
footnote: "An image classificaton app",
description: "This model classifies whether a person has a mask or not. You simply take your camera and then take your face. Then, it will go and scan it. After that, you will see that at the bottom it shows green (means you have a mask) or red (which means you dont have a mask.)",
image: "latest_1",
categoryTag: "DL",
comingSoon: false,
//modelName: ContentView())] //Another different view
这是图像: