title: Subclass URLSession iOS 10
body: <p>I'm trying to subclass <code>URLSession</code> on iOS 10 using Xcode 8. I believe the Swift type system is getting confused, but I may be missing something:</p>
  
  <pre><code>class MyURLSession: URLSession {
  
  // No errors
  override func downloadTask(with request: URLRequest) -&gt; URLSessionDownloadTask {
      return URLSessionDownloadTask()
  }
  
  // No errors
  override func downloadTask(with url: URL) -&gt; URLSessionDownloadTask {
      return URLSessionDownloadTask()
  }
  
  // See errors below
  override func downloadTask(with request: URLRequest, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Void) -&gt; URLSessionDownloadTask {
      return URLSessionDownloadTask()
  }
  
  // See errors below
  override func downloadTask(with url: URL, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Void) -&gt; URLSessionDownloadTask {
      return URLSessionDownloadTask()
  }
  }
  
  
  
  error: method does not override any method from its superclass
      override func downloadTask(with request: URLRequest, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Void) -&gt; URLSessionDownloadTask {
                    ^
  Foundation.URLSession:6:15: note: potential overridden instance method 'downloadTask(with:completionHandler:)' here
      open func downloadTask(with request: URLRequest, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Swift.Void) -&gt; URLSessionDownloadTask
                ^
  Foundation.URLSession:7:15: note: potential overridden instance method 'downloadTask(with:completionHandler:)' here
      open func downloadTask(with url: URL, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Swift.Void) -&gt; URLSessionDownloadTask
                ^
  /Users/pshah/Networking/Webservice.swift:108:19: error: method does not override any method from its superclass
      override func downloadTask(with url: URL, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Void) -&gt; URLSessionDownloadTask {
                    ^
  Foundation.URLSession:6:15: note: potential overridden instance method 'downloadTask(with:completionHandler:)' here
      open func downloadTask(with request: URLRequest, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Swift.Void) -&gt; URLSessionDownloadTask
                ^
  Foundation.URLSession:7:15: note: potential overridden instance method 'downloadTask(with:completionHandler:)' here
      open func downloadTask(with url: URL, completionHandler: @escaping (URL?, URLResponse?, Error?) -&gt; Swift.Void) -&gt; URLSessionDownloadTask
                ^
  </code></pre>