1

Looking for a way to still use an NSURLSession but override the siestaNetworkingProvider implementation to return my own NetworkingProvider. This seems impossible however since you can not override protocol extensions.

MPiccinato
  • 101
  • 1
  • 5

1 Answers1

2

You can’t override what happens when you pass an NSURLSession for the networking: param when creating a service — but that is only a convenience anyway.

You can pass your custom networking provider directly:

struct MyFancyProvider: NetworkingProvider {
  let session: NSURLSession
  // ...
}

Service(baseURL: "http://whatever", networking: MyFancyProvider(...))

(This works because NetworkingProvider itself implements NetworkingProviderConvertible.)

Paul Cantrell
  • 9,175
  • 2
  • 40
  • 48