Swift UI : Unable to infer complex closure return type; add explicit type to disambiguate

Cing Sian Dal
1 min readOct 31, 2019

--

Return only one view.

To do that, Group many views into one view:

Many Views

VStack(alignment: .center){
ForEach(my, id:\.self){row in
Button(action: {}){
Spacer()
Text("\(row)")}
Spacer()
}
}

Into one view with Group {}

VStack(alignment: .center){
ForEach(my, id:\.self){row in
Button(action: {}){
Group{
Spacer()
Text("\(row)")}
Spacer()
}
}
}
}

--

--

Cing Sian Dal
Cing Sian Dal

Written by Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.

Responses (1)