Closed saikishoreagrapalem closed 4 years ago
Alamofire's EventMonitor
protocol is intended for this use, though it's not automatic. We don't provide support for method swizzling, though it should still work. You need to be careful, as you can break Alamofire's interaction with URLSession
if you don't swizzle correctly or change types. However, the code you posted is for URLProtocol
, which Alamofire supports through URLSession
. You'd need to investigate whether it would work for your use case though.
What did you do?
I'm creating the framework which i want to monitor the network calls using alamofire also how can i achieve that using method swizzling with URLSession API's Could you please give me the example for method swizzling with URLSession with Alamofire API's
Any suggestion with brief! Appreciation.
What did you expect to happen?
Whenever Alamofire network calls on that time framework method needs to trigger and get the URL, response, request time every thing from my framework.
What happened instead?
func register() { URLProtocol.registerClass(CustomURLProtocol.self) }
func unregister() { URLProtocol.unregisterClass(CustomURLProtocol.self) }
Can't able to track the URL requset response time and all other metrics from my framework how to approach with method swizzling for this.
Thanks in advance.
Alamofire Environment
Alamofire version:5.2 Xcode version: 11.3.1 Swift version: 5.1 Platform(s) running Alamofire: iOS macOS version running Xcode: 10.15.3