ForEach causes crash after update of Xcode to Beta 3

The following code is all it takes to crash an app after updating to beta 3 of Xcode. Any file that I used a ForEach construct in will now cause an application to crash, whereas they were working well before. Anyone else seeing this issue?


struct RecipeView: View {
     var indexes: [Int] = [1,2,3,4,5]
     var body: some View {
          VStack {
               ForEach( indexes ) { index in
                    Text("\(index)")
               }
          }
     }
}

Accepted Reply

I've managed to resolve this. Apparently in beta 3, navigation link destinations no longer automatically access environment objects. In order to resolve, be sure to add the .environmentObject() modifier to any destination views. (sourced from the updated tutorial on navigation in swiftui).

Replies

I've managed to resolve this. Apparently in beta 3, navigation link destinations no longer automatically access environment objects. In order to resolve, be sure to add the .environmentObject() modifier to any destination views. (sourced from the updated tutorial on navigation in swiftui).