What can I do to fix this error?
Result of '
ForEach<Data, ID, Content>
' initializer is unused
What can I do to fix this error?
Result of '
ForEach<Data, ID, Content>
' initializer is unused
Your function have to have output in signature, ie
func descriptionItem(.. your params here ..) -> some View {
// your code here
}
Thanks I seemed to have it solved:
func descriptionItem(myFrom: Int, myTo: Int) -> some View{
ForEach(myFrom ..< myTo) { item in
Button(action: {
self.theDetail = self.mySites[item]
self.saveData()
// self.showAlert = true
}) {
Text(self.mySites[item])
.modifier(ButtonModifier())
}
}
}