I have a menu in an app that mixes a couple of UIKit and Swift. I need to access and update the menu state from different SwiftUI views that are different children from a parent view in UIKit. I am able to do it by using a EnvironmentObject, but I am struggling to pass it again a single value in a ForEach loop.
Here is the EnvironmentObject I created:
class LateralMenuStatus: ObservableObject {
@Published var status: [FilterButtonStatus] = [.off, .off, .off, .off, .off]
}
Then I pass this and iterate over it in a ForEach loop for passing it again to a child component:
Parent: UIKit View --> Child 1: SwiftUI View (I pass the whole status array) --> Children of Child 1: ForEach (pass a single value for each component)
Which is the proper way of passing a single value and modify inside the SwiftUI? I read that recent iOS 14 introduced a couple of cool updates like AppState() that could solve this but I would like to solve it with iOS 13.
Many thanks,

LateralMenuStatusis used? - Asperi