Xcode8 Swift3 PHP Need Swift3 coding to display base64 image
<p>Here is the PHP and Swift3 code I am using.  The language has been changed since earlier Swifts.  Does anyone know it?</p>

<p>The PHP program successfully retrieves the photo, and encodes it to base64.  I can see it in safari, and in the Xcode debugger.  The Xcode8/Swift3 runs without error, but it does not display an image.  Any suggestions?  </p>

<p>PHP</p>

<pre><code>&lt;?php
$photo=file_get_contents("pic3-1.jpg");
$base64=base64_encode($photo);
$data=Array("photo"=&gt;$base64");
echo json_encode($data);
?&gt;
</code></pre>

<p>This reads fine, but the Swift3 does not display it.</p>

<p>XCode8 Swift3</p>

<pre><code>    @IBAction func load(_ sender: UIButton) {

    let myUrl = NSURL(string: 
"http://www.example.com/connect9.php")

    var request = URLRequest(url:URL(string: 
"http://www.example.com/connect9.php")!)

    request.httpMethod = "POST"

    let postString = ""

    request.httpBody = postString.data(using: .utf8);

    let task = URLSession.shared.dataTask(with: request) { data, 
response, error in
        guard let data = data else {
            print("request failed \(error)")
            return
        }

        do {
            if var json = try JSONSerialization.jsonObject(with: data) 
as? [String: String], var photo64 = json["photo"] {

       var b64=photo64 as String

                var unencodedString=Data(base64Encoded: b64)

                var photo=UIImage(data: unencodedString!)!

                self.view1.image=photo

            }

        } catch let parseError {
            print("parsing error: \(parseError)")
            let responseString = String(data: data, encoding: .utf8)
            print("raw response: \(responseString)")
        }



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