-1

What can I do to fix this error?

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

enter image description here

pkamb
  • 33,281
  • 23
  • 160
  • 191
Frank
  • 35
  • 1
  • 3
  • 8
    Welcome on SO... next time provide your code as code, not as image, link, etc. so someone can copy/paste and fix/modify it. – Asperi Jun 25 '20 at 15:37

2 Answers2

4

Your function have to have output in signature, ie

func descriptionItem(.. your params here ..) -> some View {
  // your code here
}
Asperi
  • 228,894
  • 20
  • 464
  • 690
0

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())
        }
        
    }
}
Frank
  • 35
  • 1
  • 3