this is my first time working on integrate api so this is the structs of the data :
struct OsmItem: Codable {
var success: Bool
var message: String
var resultData: [ResultDatum]
}
struct ResultDatum: Codable {
var id: String
var parentID: String?
var published: Bool
var title, shortDesctiption, longDescription, iconPath: String
var iconName: String
var subCategories: [ResultDatum]
enum CodingKeys: String, CodingKey {
case id
case parentID = "parentId"
case published, title, shortDesctiption, longDescription, iconPath, iconName, subCategories
}
}
my goal is to show the data of the subcategories in the view i don't know how i only can show the of title and iconName this is my try
LazyVGrid(columns: layout , spacing :10 , content: {
ForEach(items?.resultData ?? [ResultDatum](), id: \.id) { item in
Button(action: {}, label: {
NavigationLink(destination: NewOfferStepFive().navigationBarTitle(Text("x")).navigationBarHidden(true)
.navigationBarBackButtonHidden(true) ) {
VStack {
Image(item.iconName)
.resizable()
.frame(width: 100.0, height: 100.0)
.scaledToFill()
Text(item.title)
.fontWeight(.bold)
.foregroundColor(.black)
.multilineTextAlignment(.center)
.frame(width: 145, height: 43 )
.font(.system(size: 17))
}
}
} )
}
})
any help of only showing the data of the subcategories ?