- 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!
Install through the Swift Package Manager using Xcode.
Add to your podfile
and install using pod install
.
pod 'NetworkDebugger', '1.0.2'
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
}
}
All configuration has to be called before the start()
method is called.
Simply set the ignoredHosts
property!
NetworkDebugger.ignoredHosts = [
"subdomain.example.com",
"example.com"
]
NetworkDebugger
only stores n amount of requests. You can configure this by setting the maxRequests
property!
NetworkDebugger.maxRequests = 100 // Default
To disable shake gestures simply set the shakeEnabled
property!
NetworkDebugger.shakeEnabled = false
For SwiftUI, simply return the NetworkDebuggerView()
!
struct MyView: View {
var body: some View {
NetworkDebuggerView()
}
}
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()
}
}
Name | |
---|---|
@Asmeili | [email protected] |