A search for this exact error has turned up nothing on the entire Web. I just want to create a number of copies of a view, abutted end to end, to create a horizontal layout akin to a ruler. At runtime it will create enough segments to cover a particular length.
I get the above error, however. Adding id:\.self to the forEach doesn't fix the problem.
import SwiftUI
struct MediaPositionView: View
{
var body: some View
{
HStack(spacing: 0)
{
ForEach(0..<10)
{ index in
songSegment(segIndex: index) // Static method 'buildExpression' requires that 'Content' conform to 'MapContent'
}
}
}
@ViewBuilder func songSegment(segIndex: Int) -> any View
{
ZStack
{
Color.blue
.frame(width: 50, height: 50)
Path
{ path in
path.move(to: CGPoint(x: 5, y: 25))
path.addLine(to: CGPoint(x: 5, y: 50))
}
}
}
}