// "Charles Enabler" // https://stackoverflow.com/a/57253011/584548 public class NetworkEnabler: NSObject, URLSessionDelegate { public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!)) } } // Then, when creating a URLSession instance: let urlSession = URLSession(configuration: .default, delegate: NetworkEnabler(), delegateQueue: nil) // Create a request and finally... let (data, response) = try await urlSession.data(for: request) // Profit 💰