func loadImageFromUrl() {
guard let urlString = self.urlString else {
return
}
let url = URL(string: urlString)!
let task = URLSession.shared.dataTask(with: url, completionHandler: self.getImageFromResponse(data:response:error:))
task.resume()
}
I keep on getting this fatal error (mentioned in title) for let url = URL(string: urlString)!
, even if I have tried to guard it in previous lines. Also, when I move my cursor over urlString
, it indeed shows a highlight of my intended url from the API.