I have found an erroneous invocation of onDisappear in a particular view hierarchy. If you have a NavigationView wrapping a Form, which has a NavigationLink that drills down to a Form, then the inner most Form will have its onDisappear invoked when the view appears.
Here is a code sample that reproduces it:
struct ContentView: View {
var body: some View {
NavigationView {
Form {
NavigationLink(
"Tap",
destination: Form {
Section(header: Text("Section")) {
Text("Label")
}
}
.onDisappear {
print("🛑 This should not be called")
}
)
}
}
}
}
When you tap the root navigation link you will see that it causes the onDisappear to be invoked when it should not.