SwiftUI:
EmptyView().onAppear {
//Not called
}
onAppear formally exists, but not called when view is presented?
Just simply add:
Rectangle()
.hidden()
.onAppear {
// TODO: Do something
}
Consider EmptyView is just as interface stub (to put something where view is required but at some moment there is nothing to provide). It is in a fact not inserted into view hierarchy, so .onAppear is not called, because nothing appears.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With