Thanks Claude! I've seen your answers on a lot of different questions and you are always very helpful. Now I just have to figure out how to connect the access key and parameters for the API. I think I just need to spend more time reading why everything functions the way it does before jumping in.
For anyone with this issue this is what I changed it too in context for it to work.
func Scraper() async throws -> ScrapeStruct {
guard let url = URL(string: "someurl")
else {
throw Error.invalidServerResponse
}
let request = URLRequest(url: url)
let (data, _) = try await URLSession.shared.data(for: request)
let scrapeStruct = try JSONDecoder().decode(ScrapeStruct.self, from:data)
return scrapeStruct
}
Topic:
Programming Languages
SubTopic:
Swift
Tags: