title: how to convert NSmutableURLRequest to URLRequest in Swift 4?
body: <pre><code>func requestForAccessToken(authorizationCode: String) {
      let grantType = "authorization_code"
      let redirectURL = "https://com.appcoda.linkedin.oauth/oauth".addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
      // Set the POST parameters.
      var postParams = "grant_type=\(grantType)&amp;amp;"
      postParams += "code=\(authorizationCode)&amp;amp;"
      postParams += "redirect_uri=\(String(describing: redirectURL))&amp;amp;"
      postParams += "client_id=\(linkedInKey)&amp;amp;"
      postParams += "client_secret=\(linkedInSecret)"
  
      let postData = postParams.data(using: String.Encoding.utf8)
      let request =  NSMutableURLRequest(url: NSURL(string: accessTokenEndPoint)! as URL)
      request.httpMethod = "POST"
      //http body
      request.httpBody = postData
      //headerfield
      request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
      // init the session
      let session = URLSession(configuration: URLSessionConfiguration.default)
  
      let task: URLSessionDataTask = session.dataTask(with: request) { (data, response, error) in
      // Throwing and error it needs a URLRequest at session.dataTask("Here")
  
      // Below is the error Xcode yells 
  
      // Ambiguous reference to member 'dataTask(with:completionHandler:)
  
      }
  }
  </code></pre>