Networking with Combine
We now have some of the basics; let's create a networking layer that uses Combine
. Most of this code structure is just a networking layer, but we will use URLSession
. Let's get started.
Open the API file inside of the View Model
folder and add the following:
struct API { enum Error: LocalizedError, Identifiable { var id: String { localizedDescription } case addressUnreachable(URL) case invalidResponse var errorDescription: String? { switch self { case .invalidResponse: return 'The server ...