iOS network debugging framework with real-time monitoring, JSON tree viewer, and request inspection.
- Real-time network monitoring - automatically intercepts all
URLSessionrequests - Detailed request/response inspection - headers, body, status codes, timing
- Interactive JSON tree viewer with expand/collapse
- Search and filter by URL, method, or status code
- Copy JSON responses to clipboard
- Color-coded status indicators
- Non-intrusive floating button overlay
- HAR files export functionality to save the list and a single viewed request.
In Xcode, go to File → Add Package Dependencies and enter:
https://github.com/theCodingDJ/NetTrace.git
Or add to your Package.swift:
dependencies: [
.package(url: "https://github.com/theCodingDJ/NetTrace.git", from: "1.1.0")
]Then add to your target:
.target(
name: "YourTarget",
dependencies: ["NetTrace"]
)Add the following into your AppDelegate:
import NetTrace
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
#if DEBUG
NetTrace.shared.start()
#endif
/// Other initialization code here.
return true
}NetTrace has the capability to export HAR files to share with backend developers, or view with Charles Proxy/Postman/Proxyman.
Tip
When working with iPhone Simulator, to find your stored .har files open your Terminal,
run cd ~/Library/Developer/CoreSimulator/Devices/<Simulator UDID> (you can find your Simulator's UDID in Xcode → Window menu → Devices & Simulators), then run the following command in your Terminal: find . -name '*.har'.
Initializes NetTrace and displays the floating overlay button.
#if DEBUG
NetTrace.shared.start()
#endifShows the overlay button if previously hidden.
NetTrace.shared.show()Hides the overlay button.
NetTrace.shared.hide()Clears all logged requests.
NetRecorder.shared.clear()Filters requests using complex logic.
let apiRequests = NetRecorder.shared.findRequests { request in
request.response?.statusCode == 404 && request.method == "POST"
}Filters requests by URL path.
let apiRequests = NetRecorder.shared.findRequests(byPath: "/api")Filters requests by HTTP status code.
let errors = NetRecorder.shared.findRequests(byStatusCode: 404)Filters requests by HTTP method.
let postRequests = NetRecorder.shared.findRequests(byMethod: "POST")MIT License