Combine based wrapper around URLSession
iOS 13+
MacOS 10.15+
There are three parts to using the library
private var networking: PRKChopNetworking = .init()
Create a URLRequest
using the provided createRequest
method.
let request = networking.createRequest(url: URL(string: "https://your_url.com", httpMethod: <method>, body: PRKChopEmptyBody())
let request = networking.createRequest(url: URL(string: "https://your_url.com", httpMethod: <method>, body: PRKChopEmptyBody())
networkProvider
.make(for: request)
Note that .make
is an async
function type that can throw. This method returns a Data
object type and doesn't assume how you want to transform your data.
You can chain the response with .tryTransform(type: <type>)
to be used with Decodable
type of objects or structs.