I have an error when I try to fetch data using Xcode 10 Beta and Swift 4.2.
In swift 4.1 was working perfect my method and now I have an error and I can't find a solution on internet to fix it.
Here is my code:
// Download photos from Google for products avatar
func fetchPhotosForProductsFromGoogle(){
    guard let requestURL = NSURL(string: URL.googleAPI + "q=\(query ?? "flagUK")" + URL.searchPhotosOnly + URL.googleSearchEngineID + URL.googleAPIKey)
        else{
            fatalError("URL can't be found.")
    }
    URLSession.shared.dataTask(with: requestURL) { (data, response, error) in
        guard error == nil else {
            print(error?.localizedDescription ?? "Error URL Session.")
            return
        }
        do {
            let googlePhotosList = try JSONDecoder().decode(GoogleSearchModel.self, from: data!)
        } catch {
            print(error.localizedDescription)
        }
        DispatchQueue.main.async {
            self.productsTableView.reloadData()
        }
        }.resume()
}
Here is a picture with the error:
Any idea will help me a lot ! Thanks.

 
     
     
    