Webview w/ Self Signed Certificate (SwifttUI)

Greetings, all-

I am implementing a Webview on my SwiftUI app. I am relatively new to iOS Development.

Everything works fine when using my production website or a localhost server w/o SSL. But as soon as I enable SSL and specify https://localhost:3000 as the URL, the webview opens with a blank page and the following error in the log:

2021-05-28 21:19:35.985515-0700 stagey_patron[89864:3833288] [Process] 0x7ffa0d115c20 - [pageProxyID=5, webPageID=6, PID=89874] WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain = NSURLErrorDomain, code = -1202

I have done a lot of googling but nothing seems to fix the issue.

Here is a screenshot of my Plist:

Here's the view's code:

Note that I do have my local cert configured w/ my simulator and certificate trust settings enabled.

Any help would be much appreciated.

You should add this handler to uiView.navigationDelegate instance


func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
            guard let serverTrust = challenge.protectionSpace.serverTrust else { return completionHandler(.useCredential, nil) }
            let exceptions = SecTrustCopyExceptions(serverTrust)
            SecTrustSetExceptions(serverTrust, exceptions)
            completionHandler(.useCredential, URLCredential(trust: serverTrust))
        }
Webview w/ Self Signed Certificate (SwifttUI)
 
 
Q