How do you test a URL and get a status code in Swift 3? : <p>I'm using the most recent version of Xcode (8.1 at time of writing), which uses Swift 3.0.</p>

<p>All I'm trying to do is take a string, convert it to a URL and test that URL to see if it gives me a 404 error. I've been able to make a URL and URLRequest by using:</p>

<pre><code>    let url = URL(string: fullURL)
    let request = URLRequest(url: url!)
</code></pre>

<p>but I've found myself unable to get anything working beyond that. I've searched around for help, but most, if not all of it, is written in Swift 2.0, which I've tried to convert to no avail. It seems that even if you change the naming convention to remove the NS prefix, that isn't enough. I tried using:</p>

<pre><code>    let response: AutoreleasingUnsafeMutablePointer&lt;URLRequest&gt; = nil
</code></pre>

<p>but that gives me an error that "fix-it" makes worse by sticking question marks and semi-colons everywhere.</p>

<p>Apple's documentation isn't helping me much, either. I'm seriously at a loss.</p>

<p>Does anybody know how to correctly set up and test a URL for 404 status in Swift 3.0?</p>
