TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by Mauricio Cousillas, Enrique Galindo.
By Xmartlabs SRL.
Xniffer is a non-intrusive framework for intercepting outgoing requests and their responses between your app and any external service for debugging and performance monitoring purposes.
Inspired by Response detective.
In order to work, the Xniffer needs to be added as a middleware between your URLSession and the Internet.
After the initial setup, a window will be displayed on top of the UI that will show all the current requests and their latency.
let configuration = URLSessionConfiguration.default
// The setup method adds the Xniffer's custom protocol as a middleware.
Xniffer.setup(with: configuration)
let session = URLSession(configuration: configuration)
Now we can start using this session instance for our requests!
If you are using Alamofire you can start using the Xniffer by initializing your Manager with the following:
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders
Xniffer.setup(with: configuration)
let sessionManager = Alamofire.SessionManager(configuration: configuration)
The Xniffer currently supports three modes, .window
, .console
and .custom
. The default value is .window
but this can be changed easily on the Xniffer.setup(configuration: URLSessionConfiguration, mode: XnifferUI = .window)
.
Each one of this uses a different implementation of the XnifferDelegate
.
.window
: Displays a window on top of the status bar which can be expanded to display a list of the profiled requests. This is the default value..console
: Prints the results on the Xcode console..custom
: This one receives a closure of type () -> ()
so you can use your own implementation of the XnifferDelegate
.Before contribute check the CONTRIBUTING file for more info.
If you use Xniffer in your app We would love to hear about it! Drop us a line on twitter.
Follow these 3 steps to run Example project: Clone Xniffer repository, open Xniffer workspace and run the Example project.
This can be found in the CHANGELOG.md file.