How do I create an action that occurs when a child view (showing through a NavigationLink) is dismissed? I am trying to pass a value, but can't create a function to use the received value.
Thanks in advanced.
How do I create an action that occurs when a child view (showing through a NavigationLink) is dismissed? I am trying to pass a value, but can't create a function to use the received value.
Thanks in advanced.
To perform an action when a View disappears, you can use onDisappear
func onDisappear(perform action: (() -> Void)? = nil) -> some View
To update a value from an enclosing View, you could use a Binding.
.onDisappear did not work, but .onAppear did. Thx so much!