I have been trying to do the Foundation Module 2 Wrap Up challenge and during that there shown up some errors which I don’t know how to work with, can somebody please help?
There is the code, the errors are on the three ForEach loops and they are the same (annot convert value of type ‘String’ to expected argument type ‘Binding’, Generic parameter ‘C’ could not be inferred (two errors on each ForEach loop))
import SwiftUI
struct QuoteDetail: View {
var quote:Quote
var body: some View {
ScrollView{
VStack(alignment: .leading){
Image(quote.Author)
.resizable()
.scaledToFill()
}
VStack(alignment: .leading){
Text(“Author:”)
.font(.headline)
.padding(.vertical)
ForEach (quote.Author, id:\.self) { item in
Text("• " + item)
}
Spacer()
HStack{
Text("Quote:")
.font(.headline)
.padding(.vertical)
ForEach(quote.Quote, id: \.self){
i in Text(" " + i).font(.body)
.padding(.vertical)
}
}
Spacer()
HStack{
Text("Czech Translation:").font(.headline)
.padding(.vertical)
ForEach(quote.CzechTranslation, id: \.self){
i in Text(" " + i).font(.body)
.padding(.vertical)
}
}
}
}
}
}
struct QuoteDetail_Previews: PreviewProvider {
static var previews: some View {
let model = QuoteModel()
QuoteDetail(quote: model.quotes[0])
}
}