Guppy

0.10.0

iOS pod about a curious fish named Guppy
johnsonandjohnson/Guppy-iOS

What's New

0.10.0

2022-02-03T20:28:51Z
  • Support for showing pending requests
  • Fixed issue for iOS 15 where header padding was incorrect

Guppy

Platform Swift Version CocoaPods Carthage compatible codecov License

Do you want to know what's tedious? Debugging network requests and responses if you don't have the right tools. Guppy is a logging tool focused on HTTP requests that can be easily plugged into any iOS application. Guppy will intercept and log each network request sent from the app. You can access any Guppy log and share it with the rest of your team effortlessly.

Usage

While in the simulator you can use: ^ + ⌘ + z to bring up Guppy or shake your phone.

Routes

You can dig deep into the details of your network logs and share them with your team or yourself.

Details

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

URLSession

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        Guppy.registerURLProtocol()
        
        return true
    }
}

URLSession with Custom Protocols

class Session: URLSession {
    
    init() {
        let configuration = URLSessionConfiguration.default
        
        configuration.urlCache = nil
        
        // Protocols are evaluated in reverse order
        // If GuppyURLProtocol is not the last protocol it is not guaranteed to be executed
        configuration.protocolClasses = [MyCustomProtocol, GuppyURLProtocol.self]
        
        super.init(configuration: configuration)
    }
}

Alamofire

class SessionManager: Alamofire.SessionManager {

    init() {
        let configuration = URLSessionConfiguration.default

        configuration.urlCache = nil
        configuration.protocolClasses = [GuppyURLProtocol.self]
        
        super.init(configuration: configuration)
    }
}

Requirements

  • Xcode 12.0+
  • iOS 13.0+

Installation

Guppy is best used in non-production environments. By default, installing the Guppy framework will automatically make it available when the user shakes their device. To avoid this do any combination of the following:

  • If you are using multiple targets for different environments, only include the Guppy framework in the non-production targets
  • If you are using one target with multiple configurations for different environments, only include the Guppy framework in the non-production configuration
  • Set Guppy.shared.showOnShake = false in your didFinishLaunchingWithOptions for the specific times where Guppy should not be available
https://github.com/johnsonandjohnson/Guppy-iOS.git
pod 'Guppy'
github "johnsonandjohnson/Guppy-iOS"

License

Guppy is released under the Apache 2.0 license. See LICENSE for details.

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

  • None
Last updated: Wed Apr 17 2024 19:28:48 GMT-0900 (Hawaii-Aleutian Daylight Time)