Git Product home page Git Product logo

xniffer's Introduction

Platform iOS Swift 3 compatible Carthage compatible CocoaPods compatible License: MIT

By Xmartlabs SRL.

Introduction

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.

Setup

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.

Basic usage

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!

Using Alamofire

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 = SessionManager(configuration: configuration)
let manager = NetworkManager(manager: sessionManager )

UI Modes

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, method: 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.

Requirements

  • iOS 9.0+
  • Xcode 8.0+

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug or need help please check older issues, FAQ and threads on StackOverflow (Tag 'Xniffer') before submitting an issue..

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.

Examples

Follow these 3 steps to run Example project: Clone Xniffer repository, open Xniffer workspace and run the Example project.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To install Xniffer, simply add the following line to your Podfile:

pod 'Xniffer', '~> 1.0'

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

To install Xniffer, simply add the following line to your Cartfile:

github "xmartlabs/Xniffer" ~> 1.0

Author

Change Log

This can be found in the CHANGELOG.md file.

xniffer's People

Contributors

mcousillas6 avatar mtnbarreto avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.