Search code examples
iosswiftxcodecharles-proxy

How to use Charles Proxy on an Xcode Playground?


When tying out network requests from a Swift playground, I can't see the network call in Charles Proxy. However, it works when I do network requests from an iOS simulator by following the steps in the answer here.

Would be nice to make it work for Xcode Playgrounds for faster iteration. Does anyone know what needs to be done to make it work there?


Solution

  • Unlike the simulator, Playgrounds don't have their own network configuration. If you need a proxy on a Playground then you need to proxy your Mac's network connection. That will affect every app on your Mac, which is potentially a lot of data. It should work but you might want to quit any other network-related apps that you can. If you don't need to use your browser while testing, for example, quit it until you're done.