I have an array of strings and I want to convert to array of AnyView which has Text(step). I get the error:
Type '()' cannot conform to 'View'; only struct/enum/class types can conform to protocols
What am I doing wrong?
func generateViews() -> [AnyView]{
var views: [AnyView] = []
ForEach(data.steps, id: \.self) { step in
views.append(AnyView(Text(step)))
}
return views
}