Swift 3: Cannot invoke dataTask with an argument list of type error
<p>I'm beginner in iOS. I have searched web and couldn't find answer that would solve my problem. <strong>Stuck and have no idea what to do and how to search for solution.</strong></p>

<p>I'm following the tutorial which is based on Swift 2. The following method is showing error.</p>

<pre><code>func downloadBooks(bookTitle: String) {
    let stringURL = "GET https://www.googleapis.com/books/v1/volumes?q=\(bookTitle)"

    guard let URL = URL(string: stringURL) else {
        print("url problems")
        return
    }

    let urlRequest = NSMutableURLRequest(url: URL)
    let session = URLSession.shared

    let task = session.dataTask(with: urlRequest) { (data: Data?, response: URLResponse?, error: Error?) in

    }

    task.resume()
}
</code></pre>

<p>I have made all adjustments suggested by Xcode, but no further hints.</p>

<p>Moreover, original portion of code from tutorial was like this:</p>

<pre><code>guard let URL = NSURL(string: stringURL) else {
    print("url problems")
    return
}
</code></pre>

<p>Then Xcode suggested to add <code>as URL</code> like below:</p>

<pre><code>let urlRequest = NSMutableURLRequest(url: URL as URL)
</code></pre>

<p>Both of these versions are showing <strong>no error</strong>. So what is the difference? Which one should I use?</p>

<p>I would really appreciate any help!</p>