onDestroyed(_:)¶
Runs handler once this view closes, with DocumentEnd.closing, the only reason it gets on iOS.
func onDestroyed(_ handler: @escaping (DocumentEnd) -> Void)
Discussion¶
It comes after the onDocumentEnd(_:) handlers that get closing. The WKWebView has stopped loading, paused
its media, lost every script message handler (yours too) and left the view by then, but is still alive, and the
context does nothing.
Clean up here: what attach set up on the WKWebView, such as an observation or a swapped class.