I am developing a framework where i wanna apply interceptor for all network calls,
i have managed to add interceptor at single object level, n figuring out how to add it on app level without adding my guard class each time.
code for adding interceptor at object level
func getURLSessionConfiguration() -> URLSessionConfiguration
{
let configuration = URLSessionConfiguration.default
configuration.protocolClasses?.append(MyURLProtocol.self)
return configuration
}
let defaultSession = URLSession(configuration: getURLSessionConfiguration())