This is what I've done. First, I created a struct called Specialty with 3 lets:
let type:String
let color:Color
let image:Image
Then, in other struct, I wrote:
let specialtyList = [
Specialty(type: "any_name", color: Color.any_color, image: Image("any_image") )]
In the body of the same struct that I wrote 'let spacialtyList', I have:
ForEach(specialtyList, id: \.type) { specialtyList in
NavigationLink (destination: Any()) {
HStack {
Text(specialtyList.type)
.foregroundColor(.white)
// Image(specialtyList.image)
// .renderingMode(.original)
// .resizable()
// .frame(width: 35, height: 35)
}
.frame(minWidth: 0, idealWidth: 350, maxWidth: .infinity)
.frame(height: 100)
}
.padding(.horizontal)
.background(specialtyList.color)
.cornerRadius(45)
}
The problem is that Image(specialtyList.image) don't work, I receive the error "Cannot convert value of type 'Image' to expected argument type 'String'"
I've tried to change 'specialtyList in' to 'Specialty in' but it didn't work either.