Network Debugger
A Swift package designed to view your App's networking activity with minimal setup.
Features
- Minimal setup. Add one line of code and the package does the rest!
- Built-in shake gestures that can be disabled!
- SwiftUI and UIKit compatible!
- Ignore hosts from being recorded!
- Use settings at runtime to filter the requests!
- Syntax highlighting for body data!
Installation
Swift Package Manager
Install through the Swift Package Manager using Xcode.
Cocoa Pods
Add to your podfile
and install using pod install
.
pod 'NetworkDebugger', '1.0.1'
Setup
In order for the package to work properly, you need to call start()
as the first method in your AppDelegate
! (For SwiftUI apps you need to use @UIApplicationDelegateAdaptor
)
Note: It is highly encouraged to only call start()
in debug or testing environments and not in production.
final class ApplicationDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
#if DEBUG
NetworkDebugger.start()
#endif
}
}
Configuration
All configuration has to be called before the start()
method is called.
Ignoring hosts
Simply set the ignoredHosts
property!
NetworkDebugger.ignoredHosts = [
"subdomain.example.com",
"example.com"
]
Limiting amount of requests
NetworkDebugger
only stores n amount of requests. You can configure this by setting the maxRequests
property!
NetworkDebugger.maxRequests = 100 // Default
Disabling shake gestures
To disable shake gestures simply set the shakeEnabled
property!
NetworkDebugger.shakeEnabled = false
Displaying NetworkDebugger
SwiftUI
For SwiftUI, simply return the NetworkDebuggerView()
!
struct MyView: View {
var body: some View {
NetworkDebuggerView()
}
}
UIKit
For UIKit, simply call presentNetworkDebugger()
! Optionally you can provide the UIViewController
to present NetworkDebugger
on.
class MyViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// If the ViewController is known
NetworkDebugger.presentNetworkDebugger(on: self)
// Will attempt to display on the top most ViewController
NetworkDebugger.presentNetworkDebugger()
}
}
Maintainers
Network Debugger
A Swift package designed to view your App's networking activity with minimal setup.
Features
Installation
Swift Package Manager
Install through the Swift Package Manager using Xcode.
Cocoa Pods
Add to your
podfile
and install usingpod install
.Setup
In order for the package to work properly, you need to call
start()
as the first method in yourAppDelegate
! (For SwiftUI apps you need to use@UIApplicationDelegateAdaptor
) Note: It is highly encouraged to only callstart()
in debug or testing environments and not in production.Configuration
All configuration has to be called before the
start()
method is called.Ignoring hosts
Simply set the
ignoredHosts
property!Limiting amount of requests
NetworkDebugger
only stores n amount of requests. You can configure this by setting themaxRequests
property!Disabling shake gestures
To disable shake gestures simply set the
shakeEnabled
property!Displaying NetworkDebugger
SwiftUI
For SwiftUI, simply return the
NetworkDebuggerView()
!UIKit
For UIKit, simply call
presentNetworkDebugger()
! Optionally you can provide theUIViewController
to presentNetworkDebugger
on.Maintainers