Skip to content

Commit 5471168

Browse files
author
Revanth
committed
Updated readme
1 parent 15a3762 commit 5471168

1 file changed

Lines changed: 43 additions & 38 deletions

File tree

README.md

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,67 @@
1-
# NetworkInspector
1+
**NetworkInspector**
22

3-
NetworkInspector is a lightweight in-app network inspection tool for iOS.
4-
It intercepts `URLSession` traffic and provides a built-in UI to inspect
5-
requests, responses, headers, status codes, timing, and payloads.
3+
NetworkInspector is a lightweight, in-app network inspection tool for iOS apps.
4+
It intercepts URLSession traffic and provides a built-in UI to inspect HTTP requests and responses in real time.
65

7-
This tool is intended **strictly for DEBUG builds**.
6+
DEBUG builds only. Do not ship this tool in production.
87

9-
---
8+
**What It Does (Precisely)** :
109

11-
## Features
10+
NetworkInspector works by registering a custom URLProtocol that observes network traffic initiated through URLSession.
1211

13-
- Intercepts all HTTP/HTTPS requests using `URLProtocol`
14-
- Captures request & response headers, body, status code, and timing
15-
- In-memory log storage with size limits
16-
- Built-in inspector UI (list → detail → tabs)
17-
- Pretty-printed JSON responses
18-
- Floating overlay button (does not interfere with app UI)
19-
- Works with UIKit and SwiftUI apps
12+
• Request method, URL, headers, and body
13+
• Response headers, status code, and body
14+
• Request timing and duration
15+
• Base URL grouping for easier filtering
2016

21-
---
17+
All logs are stored in memory only (no disk persistence).
2218

23-
## Installation (Swift Package Manager)
19+
**Features:**
2420

25-
Add the package using Xcode:
21+
• Intercepts HTTP/HTTPS traffic using URLProtocol
22+
• Intercept all requests or only selected base URLs
23+
• Captures request and response headers and bodies
24+
• Captures status codes and timing information
25+
• In-memory log storage with size limits
26+
• Built-in inspector UI (List → Detail → Tabs)
27+
• Pretty-printed JSON responses
28+
• Share requests as cURL commands
29+
• Floating overlay button that does not block app interaction
30+
• Works with UIKit and SwiftUI
2631

27-
File → Add Packages → Paste repository URL
32+
**Installation (Swift Package Manager)**
2833

29-
## Usage
34+
• Open Xcode
35+
• Go to File → Add Packages
36+
• Paste https://github.com/Rev0212/iOS-NetworkInspector
37+
• Add the package to your app target
3038

31-
Enable the inspector in **DEBUG** builds only:
39+
**Usage**
40+
Enable the inspector in DEBUG builds to intercept all requests:
3241

33-
```swift
3442
#if DEBUG
3543
NetworkInspector.LeapInspector.enable()
3644
NetworkInspector.LeapInspector.enableFloatingButton()
3745
#endif
38-
```
3946

40-
A floating 📡 button will appear on screen.
41-
Tap it to open the network inspector UI.
47+
To intercept only specific base URLs:
4248

43-
To capture only specific base URLs, pass one or more base addresses:
44-
45-
```swift
4649
#if DEBUG
47-
NetworkInspector.enable(
48-
baseURLs: [
49-
"https://mario-api.leapscholar.com",
50-
"https://mario-ieltsbff.leapscholar.com"
51-
]
52-
)
50+
NetworkInspector.enable(baseURLs: ["https://my-api.com", "https://my-base-api.com"])
5351
NetworkInspector.enableFloatingButton()
5452
#endif
55-
```
5653

57-
---
5854

59-
## API Tab
55+
**Inspector UI**
56+
• Floating button opens the inspector
57+
• Browse requests in a list view
58+
• Inspect headers, body, response, and timing
59+
• Share as cURL or delete logs
60+
• Overlay does not interfere with app UI
61+
62+
**Important Notes**
6063

61-
The inspector UI includes an **APIs** tab that lists unique endpoints and the number
62-
of calls for each. Tap an endpoint to view only the logs for that API.
64+
• DEBUG builds only
65+
• Works only with URLSession
66+
• Logs cleared on app restart
67+
• Intended strictly as a developer debugging tool

0 commit comments

Comments
 (0)