Have the following problem here. I have a root view and some action happens that triggers a sheet to be shown. When the sheet is dismissed the root view’s onAppear
isn’t called.
Example:
struct ContentView: View {
@State var toggle: Bool = false
var body: some View {
Button("(toggle ? "Hide" : "Show")") {
toggle.toggle()
}
.sheet(isPresented: $toggle) {
Text("Hello, World!")
}
.onAppear {
print("body.onAppear")
}
}
}
What I have read and searched is for me to use onDismiss
for the sheet but I want the action to be view specific not sheet dismissal specific as the sheet can be opened from many places across the app.