title: How to implement URLSessionDelegate to allow self signed certificate? (iOS/Swift)
body: <p>I'm trying to use SocketIO to connect to a server running on my workstation from an iOS/Swift app. The certificate I'm using on the server is self-signed and I'm using the following code to connect:</p>
  
  <pre><code>import UIKit
  import SocketIO
  
  
  class ViewController: UIViewController, URLSessionDelegate {
      let socketManager = SocketManager(socketURL: URL(string:"https://my_server_url")!,
                          config: [SocketIOClientOption.log(true),
                                   SocketIOClientOption.forcePolling(true),
                                   SocketIOClientOption.selfSigned(true),
                                   SocketIOClientOption.sessionDelegate(self)])
  
  
      func URLSession(_ session: URLSession,
                      task: URLSessionTask,
                      didReceive challenge: URLAuthenticationChallenge,
                      completionHandler: (URLSession.AuthChallengeDisposition, URLCredential?)
          -&gt; Void) {
          print("didReceive challenge")
          completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
      }
  </code></pre>
  
  <p>Unfortunately I get the following error: Argument type '(ViewController) -> () -> (ViewController)' does not conform to expected type 'URLSessionDelegate' where I set the sessionDelegate to self.</p>
  
  <p>I'm not sure why that is the case since all funcs in URLSessionDelegate are optional and I thought that my implementation of URLSession conformed to the protocol. I apologise if I'm doing something dumb but I'm new to iOS and Swift and I've been looking for an answer for hours with no success!</p>