NetChecker
No description available
Install / Use
/learn @shakhzodsunnatov/NetCheckerREADME
Why NetChecker?
Stop switching between your app and external proxy tools. NetChecker brings professional-grade network debugging directly into your development workflow — with zero configuration and a beautiful native UI.
// That's it. One line to start.
TrafficInterceptor.shared.start()
📸 Screenshots
<p align="center"> <img width="180" alt="Shake Inspector" src="https://github.com/user-attachments/assets/003cdd12-9abc-41f3-b19e-88ee0497c45a" /> <img width="180" alt="Menu Options" src="https://github.com/user-attachments/assets/223f364d-518f-4275-b01b-acf45c9c6f82" /> <img width="180" alt="Edit & Retry" src="https://github.com/user-attachments/assets/6cf31d28-f0f0-4adc-9e21-3bf49e03cb11" /> <img width="180" alt="Traffic List" src="https://github.com/user-attachments/assets/fb76cf9d-4b36-45bf-a7a7-fbc88e731026" /> </p> <p align="center"> <em>Shake Inspector • Menu Options • Edit & Retry • Traffic List • Request Details</em> </p>🎭 Mock Rules
<p align="center"> <img width="180" alt="Mock Rules List" src="https://github.com/user-attachments/assets/f5022f7a-b304-45ef-ba3f-fbc51a52b8d7" /> <img width="180" alt="Edit Mock Rule" src="https://github.com/user-attachments/assets/a2b32b58-54be-4931-8288-facfdc4f75d6" /> <img width="180" alt="Create Mock Rule" src="https://github.com/user-attachments/assets/3b249884-3f3d-4ab3-b709-5d276a17abc8" /> </p> <p align="center"> <em>Mock Rules List • Edit Mock Rule • Create Mock Rule</em> </p>⏸️ Breakpoints
<p align="center"> <img width="180" alt="IMG_1889" src="https://github.com/user-attachments/assets/c8aa0613-322c-45e0-8a48-55be34dd9800" /> <img width="180" alt="IMG_1892" src="https://github.com/user-attachments/assets/9121c223-9266-49c5-af35-3f093fe686f2" /> <img width="180" alt="IMG_1893" src="https://github.com/user-attachments/assets/0bbabaec-2c26-4bd5-8815-226c264eb618" /> <img width="180" alt="Screenshot" src="https://github.com/user-attachments/assets/e7ea3d7f-39d1-460a-876d-1f820a2238ad" /> </p> <p align="center"> <em>Breakpoints List • Paused Request • Edit & Resume • Request Modification</em> </p>✨ Features
<table> <tr> <td width="50%">🔍 Real-Time Traffic Monitoring
Capture every HTTP/HTTPS request your app makes. See requests as they happen with live updates.
📊 Detailed Request Analysis
- Headers, body, query parameters
- Cookies inspection
- JSON syntax highlighting
- Binary data preview
⏱️ Performance Timing
Visual waterfall charts showing:
- DNS lookup
- TCP connection
- TLS handshake
- Time to first byte
- Content download
🎭 Powerful Mocking Engine
Create mock responses without touching your backend:
- URL pattern matching (regex support)
- Custom status codes & headers
- Simulated delays & errors
- Priority-based rule matching
⏸️ Request Breakpoints
Pause, inspect, and modify requests in real-time:
- Edit headers on-the-fly
- Modify request body
- Change URL endpoints
- Auto-resume with timeout
🌍 Environment Switching <sup><kbd>Coming Soon</kbd></sup>
Switch between environments instantly:
- Dev / Staging / Production
- Quick URL overrides
- Per-host configuration
- Environment variables
More Powerful Features
| Feature | Description | |---------|-------------| | 🔄 Edit & Retry | Modify any captured request and resend it instantly | | 📋 Export to cURL | Copy any request as a cURL command | | 📦 HAR Export | Export traffic sessions in standard HAR format | | 🔐 SSL Inspection | View TLS version, cipher suites, and certificate chains | | 🎨 Native SwiftUI | Beautiful, responsive UI that feels right at home | | 💾 Persistent Rules | Mock rules and breakpoints survive app restarts | | 🚀 Zero Dependencies | Pure Swift — no third-party libraries required |
📦 Installation
Swift Package Manager
Add NetChecker to your project using Xcode:
- Go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/shakhzodsunnatov/NetChecker.git - Select Up to Next Major Version with
1.2.0
Or add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/shakhzodsunnatov/NetChecker.git", from: "1.2.0")
]
Then add the product to your target:
.target(
name: "YourApp",
dependencies: [
.product(name: "NetCheckerTraffic", package: "NetChecker")
]
)
🚀 Quick Start
Option 1: Shake-to-Open (Recommended)
The easiest way to integrate NetChecker — just add the .netChecker() modifier:
import SwiftUI
import NetCheckerTraffic
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.netChecker() // ← Shake device to open inspector!
}
}
}
That's it! Shake your device to open the traffic inspector. No UI changes needed.
Option 2: Tab-Based Integration
For permanent access, add a Traffic tab:
import SwiftUI
import NetCheckerTraffic
struct ContentView: View {
var body: some View {
TabView {
YourMainView()
.tabItem { Label("Home", systemImage: "house") }
TrafficListView() // ← Add this tab
.tabItem { Label("Network", systemImage: "network") }
}
.onAppear {
TrafficInterceptor.shared.start()
}
}
}
Option 3: Manual Start Only
If you just want interception without UI:
import NetCheckerTraffic
// In your App's init or AppDelegate
TrafficInterceptor.shared.start()
📱 The .netChecker() Modifier
The simplest way to add network debugging to your app:
ContentView()
.netChecker()
Features
- Shake to Open: Shake your device to instantly open the traffic inspector
- Full Inspector UI: Traffic list, environment switching, mock rules, and settings
- Zero UI Changes: Works with any app structure — tabs, navigation, or custom layouts
- Presentation Styles: Choose between sheet or full-screen cover
Configuration Options
// Default: shake-to-open with sheet presentation
.netChecker()
// Disable shake gesture (use programmatic trigger)
.netChecker(triggerOnShake: false)
// Full screen presentation
.netChecker(presentationStyle: .fullScreenCover)
// Disable in production
.netChecker(enabled: false)
// Alternative name
.trafficInspector()
Conditional Enablement
ContentView()
#if DEBUG
.netChecker()
#endif
📖 Documentation
Interception Levels
Choose the level of detail you need:
// Full interception — headers + body + timing
TrafficInterceptor.shared.start(level: .full)
// Basic — works with all URLSession configurations
TrafficInterceptor.shared.start(level: .basic)
// Manual — for custom URLSession setups
TrafficInterceptor.shared.start(level: .manual)
Configuration Options
Fine-tune the interceptor to your needs:
var config = InterceptorConfiguration()
// Capture only specific hosts
config.captureHosts = ["api.myapp.com", "cdn.myapp.com"]
// Ignore noisy hosts
config.ignoreHosts = ["analytics.com", "crashlytics.com"]
// Limit memory usage
config.maxRecords = 500
// Redact sensitive headers in logs
config.redactedHeaders = ["Authorization", "X-API-Key"]
TrafficInterceptor.shared.start(configuration: config)
🎭 Mocking API Responses
Create mock responses without a backend:
let mockEngine = MockEngine.shared
// Mock a JSON response
mockEngine.mockJSON(
url: "*/api/users/*",
json: """
{
"id": 1,
"name": "John Doe",
"email": "john@example.com"
}
""",
statusCode: 200
)
// Simulate network errors
mockEngine.mockError(
url: "*/api/payments/*",
error: .networkError(.notConnectedToInternet)
)
// Add artificial latency
mockEngine.mockDelay(
url: "*/api/slow-endpoint",
seconds: 3.0
)
Mock Rule Priority
Rules are matched in priority order:
let rule = MockRule(
matching: MockMatching(urlPattern: "*/api/*", method: .post),
a
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
