Below is the body of my main entry view for a widget.
onAppear seems to be working fine, but onDisappear is never getting called.
How can I know that widget is offscreen and not visible to the user?
Are there any other events similar to view controller lifecycle for a swiftui view?
onAppear seems to be working fine, but onDisappear is never getting called.
How can I know that widget is offscreen and not visible to the user?
Are there any other events similar to view controller lifecycle for a swiftui view?
Console outputvar body: some View {
Text("Hello world")
.onAppear{
print("onAppear called")
}
.onDisappear {
print("onDisappear called")
}
}
onAppear called