title: Cannot use mutating member on immutable value: 'self' is immutable
body: <p>I don't understand why I'm getting this error. <code>SomeController</code> is a class, not a struct, and it is not immutable. Is there a work around to this?</p>
  
  <pre><code>class SomeController: APIFetchable {
  
      let baseUrl = "https://jsonplaceholder.typicode.com"
      let defaultSession =  URLSession(configuration: .default)
      var dataTask: URLSessionTask?
  
      func fetchDataFromAPI(atPath path: String, _ callback: ()-&gt; Void){
          fetchDataAtPath(path) { data, error in  /*Error on this line -&gt; "Cannot use mutating member on immutable value: 'self' is immutable"*/
  
          }
      }
  
  }
  
  
  protocol APIFetchable {
      var baseUrl: String {get}
      var defaultSession: URLSession {get}
      var dataTask: URLSessionTask? {get set}
  
      mutating func fetchDataAtPath(_ path: String,  _ callback: @escaping (Data?, Error?)-&gt; Void)
  }
  
  extension APIFetchable {
  
      mutating func fetchDataAtPath(_ path: String,  _ callback: @escaping (Data?, Error?)-&gt; Void){
          dataTask?.cancel()
  
          if var urlComponents = URLComponents(string: baseUrl) {
              urlComponents.path = path
  
              guard let url = urlComponents.url else {return}
  
              dataTask = defaultSession.dataTask(with: url) { data, response, error in
                  defer {self.dataTask =  nil}
  
                  if let error = error {
                      print("data task error \(error.localizedDescription)")
                      callback(nil, error)
                  } else if let data = data, let response = response as? HTTPURLResponse, response.statusCode == 200 {
                      callback(data, nil)
                  }
              }
              dataTask?.resume()
          }
      }
  
  
  }
  </code></pre>