Crash when navigating back from SFSafariViewController in iOS 16 using SwiftUI
I'm getting frustrated with I'm experiencing a crash when I attempt to dismiss an `SFSafariViewController` and navigate back to my SwiftUI view. The crash occurs intermittently and is accompanied by the following behavior message: `Thread 1: Fatal behavior: Unexpectedly found nil while implicitly unwrapping an Optional value`. Here's the code snippet where I present the `SFSafariViewController`: ```swift import SwiftUI import SafariServices struct ContentView: View { @State private var isSafariPresented = false var body: some View { Button("Open Safari") { isSafariPresented = true } .sheet(isPresented: $isSafariPresented) { SafariView(url: URL(string: "https://www.example.com")!) } } } struct SafariView: UIViewControllerRepresentable { var url: URL func makeUIViewController(context: Context) -> SFSafariViewController { SFSafariViewController(url: url) } func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {} } ``` I've checked that the URL is valid, and the `isSafariPresented` state variable is being managed correctly. However, after dismissing the Safari view, I notice that sometimes the state of the `ContentView` seems to be lost, leading to this crash. I tried using `UIApplication.shared.isProtectedDataAvailable` before the dismissal as a safeguard, but that didn't resolve the scenario. Additionally, using `DispatchQueue.main.async { ... }` around the state update also didn’t help. Has anyone else faced this scenario or found a workaround to ensure safe navigation back from `SFSafariViewController`? Could this be a bug in iOS 16, or am I overlooking something in my SwiftUI integration? I'm on Ubuntu 20.04 using the latest version of Swift. I'd love to hear your thoughts on this.