I am trying to pass an array to another view. I want to pass the array simulation to operating conditions view.
@State var simulation = [Any]()
I know you can not see all the code but below is where if a button is pressed to show the operating conditions view and pass in an array after the array is loaded with data I have checked to make sure Simulation array does have values in it before passing and it does.
.sheet(isPresented: $showingOperatingConditions) {
OperatingConditionsView(threats: simulation)
}
Here is the operating conditions view where threats is declared. For some reason, the array is empty every time I load the view. Can anybody help?
struct OperatingConditionsView: View {
@State public var threats = [Any]()
}
@Stateto @Binding if you are going to change the array otherwise just remove@State. Off topic but why is the array declared as [Any]?