Give your simulator superpowers

RocketSim: An Essential Developer Tool
as recommended by Apple

Exclusive Pre-Launch Offer: Get 20% Off atgoing-indie.com

Inspect network traffic using the Xcode Simulator

Inspecting network traffic is an essential skill for app developers. Several tools allow you to monitor requests going in and out of your app, each with pros and cons.

When building an app, you’ll likely perform network calls to fetch data for your views. Whether you’re debugging a request failure or looking to verify an expected JSON response, inspecting network traffic is a crucial part of app development. Several tools are available, and I’ll share my favorite today.

Inspecting network traffic using RocketSim’s Network Monitor

Using RocketSim’s Network Monitor, you can inspect network traffic for your apps in real-time. A summary of each request appears in the side window, and a detailed console allows you to investigate further.

Note that RocketSim uses the open-source library Pulse, for which a big shoutout follows later.

RocketSim’s Network Monitor allows you to inspect URLSession requests.

You can click on one of the requests in the side window to investigate directly. Using filters, you’ll only see requests from APIs that you’re interested in. Once you’ve found the request you need, you can explore things like request & response headers and JSON responses:

Filter network requests and explore JSON responses.
Filter network requests and explore JSON responses.

The cURL tab allows you to perform the same request in the terminal using a cURL command. The metrics tab shows details like connection steps and response times, allowing you to indicate where a potential server improvement might be required.

Inspect the performance of your requests and find out where there's room for speed improvements.
Inspect the performance of your requests and find out where there’s room for speed improvements.

These are just a few of the features you can find inside RocketSim’s Network Monitor.

Get RocketSim from the Mac App Store

Effortless Network Monitoring: Track Requests Without Affecting Mac Connectivity or Installing Certificates

RocketSim’s Network monitor allows you to inspect network traffic without affecting your Mac connectivity or installing any certificates. Unlike proxies like Charles Proxy or Proxyman, RocketSim works by swizzling URLSession callbacks using a dynamic library. This technique is common for tracing tools like OpenTelemetry and comes with no performance decrease or overhead.

Instead, you’ll need to integrate RocketSim Connect, a dynamic library for debug builds only. You can load this library via code or a user-breakpoint. This puts you in control and ensures you’re only connecting to RocketSim when you want to. It also ensures you only monitor requests from the app you’re building.

Open Sourced: Pulse

RocketSim’s Network Monitor would not have been possible without Alex Grebenyuk‘s work. His open-sourced library Pulse provides all the features you’ve seen today.

Since it’s open-sourced, you can also improve the console view further. Your changes will eventually appear in RocketSim’s Network monitor.

If you’re looking for a more advanced networking monitor, I encourage you to check out Alex’s Pulse Pro.

Stay updated with the latest in Swift & SwiftUI

Join 19,800 Swift developers in our exclusive newsletter for the latest insights, tips, and updates. Don't miss out – join today!

You can always unsubscribe, no hard feelings.

Alternative Network Proxies considered

While RocketSim works great for my use cases, you might want a different solution. As I mentioned in the intro, each tool has pros and cons. Two popular alternatives are Proxyman and Charles Proxy.

Both are HTTP proxies, but Proxyman always feels like the modern version of Charles Proxy. I’ve been using the latter for years but recently switched to Proxyman when I had to perform more advanced network debugging, like mocking or using breakpoints. However, I have always disliked the idea of having my Mac network monitored, so I’m happy with using RocketSim for general inspection of network traffic.

Conclusion

Just like Optimizing your app for Network Reachability, inspecting network traffic is an essential skill for app developers. Several tools are available, but only RocketSim allows you to monitor requests without influencing your Mac’s network connectivity or installing any certificates.

If you like to improve your Xcode knowledge, even more, check out the Xcode category page. Feel free to contact me or tweet me on Twitter if you have any additional tips or feedback.

Thanks!

 
Antoine van der Lee

Written by

Antoine van der Lee

iOS Developer since 2010, former Staff iOS Engineer at WeTransfer and currently full-time Indie Developer & Founder at SwiftLee. Writing a new blog post every week related to Swift, iOS and Xcode. Regular speaker and workshop host.