I'm trying to wrap my head around Combine still, and so in my class that handles web requests I've written this method:
static func downloadNumbersPublisher(datesByType: [LottoType: (start: Date, end: Date)]) -> URLSession.DataTaskPublisher {
guard let url = downloadUrl(using: datesByType) else { return }
var request = URLRequest(url: url)
request.addValue("gzip", forHTTPHeaderField: "Accept-Encoding")
let session = URLSession(configuration: .ephemeral)
return session.dataTaskPublisher(for: request)
}
What I'm not clear on though is what I actually return on line 2, the guard statement.