I'm developing my first iOS App, using Xcode 11.3 and Swift5.
But I was stuck in using ForEach on view.
I want to put certain struct in ZStack using Foreach but still get errors.
Error : Unable to infer complex closure return type; add explicit type to disambiguate
I don't know how to solve this. Can you help me?
/* Struct I want to put in */
struct Verses: Identifiable{
var id: Int
var verse : Int
}
/* I want to load all values from struct using foreach in view. */
ZStack {
ForEach(controller.verses) { w in <- Here is where I get error.
Rectangle()
.foregroundColor(Color.white)
.cornerRadius(28)
.opacity(0.4)
.offset(x:0, y:68)
.frame(width:290, height:280)
CardView(date: w.date)
.gesture(DragGesture()
.onChanged({ (value) in
......