title: Swift 2.0: HTTP GET error handling in Xcode 7
body: <p>I'm new with xcode programming, I'm trying to implement an App in Swift 2 that makes an HTTP Get request. After upgrading xcode 7 its showing error of:</p>
  
  <pre><code>Cannot convert value of type 
  '(NSData!, response: NSURLResponse!, err: NSError!) -&gt; ()'
  to expected argument type 
  '(NSData?, NSURLResponse?, NSError?) -&gt; Void'
  </code></pre>
  
  <p>(This code snippet uses the old error handling of swift 1.2.) Can anyone help me please how to implement this in Swift 2.0.</p>
  
  <pre><code>    request.HTTPMethod = "GET"
      let session = NSURLSession.sharedSession()
      let task = session.dataTaskWithRequest(request, completionHandler:loadedData)
  
      task.resume()
  
  
  }
  
  func loadedData(data:NSData!, response:NSURLResponse!, err:NSError!){
  
      if(err != nil)
      {
          print(err?.description)
      }
      else
      {
          var jsonResult: NSDictionary = NSDictionary()
          let httpResponse = response as! NSHTTPURLResponse
          print("\(httpResponse.statusCode)")
  
          if (httpResponse.statusCode == 200)
          {
  
              jsonResult = (try! NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers)) as! NSDictionary
              print(jsonResult)
  
  
              self.performSegueWithIdentifier("SuccessSignin", sender: self)
  
          }
          else if (httpResponse.statusCode == 422){
  
              print("422 Error Occured...")
          }
  
  
      }
  
  }
  </code></pre>