Environment: macOS 14.0 Sonoma, Swift 5.9, Xcode 15.0.1.
I'm working thru the subject project and I get an error in this statement
let searchResult = try JSONDecoder().decode(SearchResult.self, from: data)
If I run Paul's downloaded solution (just in case I typed something wrong)I get the same error. Paul provides a generic error view, specifucally:
"Sorry, your search failed – please check your internet connection then try again."
I added a comprehensive do | catch to the JSONDecoder statement to get the actual error:
Key 'CodingKeys(stringValue: "previewUrl", intValue: nil)' not found: No value associated with key CodingKeys(stringValue: "previewUrl", intValue: nil) ("previewUrl").
codingPath: [CodingKeys(stringValue: "results", intValue: nil), _JSONKey(stringValue: "Index 2", intValue: 2)]
Any help would be greatly appreciated.