title: Use of undeclared type 'T' Xcode 9
body: <p>I have this error since I have updated to Xcode 9:</p>
  
  <blockquote>
    <p>Use of undeclared type 'T'</p>
  </blockquote>
  
  <pre><code>func addDistance(center: CLLocationCoordinate2D, latitudeKey: String = "lat", longitudeKey: String = "lng") -&gt; [T] {
  
      return self.map { (obj) -&gt; T in
  
          // Calculate distance
          let location = CLLocation(latitude: obj.value(forKeyPath: latitudeKey) as! CLLocationDegrees, longitude: obj.value(forKeyPath: longitudeKey) as! CLLocationDegrees)
          let center = CLLocation(latitude: center.latitude, longitude: center.longitude)
          let distance = location.distance(from: center)
  
          // Save
          obj.objDist = distance
  
          return obj
  
      }
  
  }
  </code></pre>