That is my correct mannequin for the variables and values that’s to be saved in it from the api.
struct Gadgets : Hashable,Codable {
var id,origin_station_code,destination_station_code : Int
var station_path : [Int]
var date,state,metropolis,map_url : String
}
That is the View
:
struct SheetView: View {
var objects : Gadgets
@EnvironmentObject var viewModel: ViewModel
@EnvironmentObject var personvm : PersonViewModel
var physique: some View
{
VStack(spacing:30)
{
URLImage(urlstring: objects.map_url)
VStack(spacing:20)
{
HStack
{
VStack
{
Textual content("Experience ID").font(.subheadline)
Textual content("(objects.id)").fontWeight(.daring)
}
Spacer()
VStack
{
Textual content("Origin Station").font(.subheadline)
Textual content("(objects.origin_station_code)").fontWeight(.daring)
}
}//First row
Divider()
HStack
{
VStack
{
Textual content("Date").font(.subheadline)
Textual content(objects.date).fontWeight(.daring)
}
Spacer()
VStack
{
Textual content("Distance").font(.subheadline)
Textual content("100Km").fontWeight(.daring)
}
}//Second row
Divider()
HStack
{
VStack
{
Textual content("State").font(.subheadline)
Textual content(objects.state).fontWeight(.daring)
}
Spacer()
VStack
{
Textual content("Distance").font(.subheadline)
Textual content(objects.metropolis)
}
}//third row
Divider()
VStack{
Textual content("Station Path").font(.subheadline)
Textual content("(objects.station_path)") //The error happens right here and I'm unable to print the array fetched from the api name
}
}
}
}