What have I done wrong? I am trying to "List" a set of string values from an array, I spent all day trying to get it to work. What have I done wrong?
import SwiftUI
struct ContentView: View {
@State private var menuItems = ["Settings", "Readings Entry", "Food Diary"]
@State private var targets = ["Settings()", "ReadingsEntry()", "FoodDiary()"]
var body: some View {
NavigationStack {
List {
ForEach(menuItems) { menuLine in
print(menuLine)
}
}.navigationTitle("Menu")
}
}
}
The latest set of Error messages are:
Against the ForEach Line : Cannot convert value of type '[String]' to expected argument type 'Range<Int>'
Against the print line3: Type '()' cannot conform to 'View'