In the following example how can I change the value of activeSheet
based on how SwiftUI updates aArrived
and bArrived
?
struct ContentView: View {
@AppStorage("didAArrive") var aArrived: Bool = false
@AppStorage("didBArrive") var bArrived: Bool = false
enum ActiveSheet: Identifiable {
case aArrived, bArrived
var id: Int {
hashValue
}
}
@State private var activeSheet: ActiveSheet?
var body: some View {
Text("Hello")
.sheet(
item: $activeSheet,
content: { item in
switch item {
case .aArrived:
Text("A arrived")
case .bArrived:
Text("B arrived")
}
}
)
}
}