How to disambiguate a foreach loop in Xcode with SwiftUI

前端 未结 2 1935
孤城傲影
孤城傲影 2021-01-29 06:21

I am trying to create a hexagon grid using swiftUI on Xcode. To loop over the creation of the individual hexagons I am using a foreach loop. However I came Across an error when

2条回答
  •  借酒劲吻你
    2021-01-29 06:36

    How do I give this loop an explicit type?

    ForEach(-5...5, id: \.self) { (Ynumber) -> _ExplicitType_ in
      ...
      return self.hexagon(
                ...
             )
    }
    

提交回复
热议问题