When migrating to swift 3 why does this code no longer work and asks that it expects a ',' separator?
import UIKit
class ProfileButton: UIButton {
func setProfileImage(address: String?) {
self.setImage(UIImage(named: "iconProfile"), for: [])
if let img = address {
if !img.isEmpty {
URLSession.shared().dataTask(URLRequest.with: imgRequest(image: img) as URLRequest, completionHandler: {(data: Data?, response: URLResponse?, error: Error?) in
if let imageData = data, image = UIImage(data: imageData) {
dispatch_async(dispatch_get_main_queue()) {
self.setImage(image.profileImage(), forState: .Normal)
}
} else if let status = (response as? HTTPURLResponse)?.statusCode {
print("image loading status code: \(status)")
}
}).resume()
}
}
}
}