0

This is my body:

var body: some View {
    NavigationView {
        List {
            MonthElementView(month: month)
            ServiceElementView(service: month.services.first!)
            ServiceElementView(service: month.services.first!)
        }
    }
}

And it works.

But I need to display here ServiceElementView for every Service of the Month, and I don't know how to do it with SwiftUI. The following solution doesn't work:

enter image description here

halfer
  • 19,824
  • 17
  • 99
  • 186
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358

1 Answers1

2

You're using the wrong forEach.

It's…

ForEach(month.sortedServices) { service in

}
Ashley Mills
  • 50,474
  • 16
  • 129
  • 160