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())
}

    }
}

your function has no return type (Void). add -> some View to the end to fix it.

1 Like

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

PS

You can put code inside tripple tick mark

```
Like this
```

So it'll be rendered

Like this
3 Likes