Initializer unused

Any help on this?

Result of ‘ForEach<Data, ID, Content>’ initializer is unused

func descriptionItem(myFrom: Int, myTo: Int) {
ForEach(myFrom …< myTo) { item in
Button(action: {
self.myDetail = self.mySites[item]
self.saveData()
// self.showAlert = true
}) {
Text(self.mySites[item]).modifier(ButtonModifier())
}

    }
}

Thanks I did this:
func descriptionItem(myFrom: Int, myTo: Int) → some View{
and it works now.

Hi @flmcl, try adding a return type to your function.

Best,
Gina

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.