How to Generate Swift/Objective-C Networking Code Using Postman

Postman is a popular app for API testing. If you are an iOS Developer, high chances you must have used it. Postman has a useful feature, which let us generate networking code in our preferred language, for the APIs we are testing. Let me show you how it works. swift networking postman

Fill in details of the API call in postman or select one from the history tab, for which you need to generate code. Test the API call, if all looks good, press the ‘Code’ option.

swift code postman

You can now see the code for the API request. You can also choose the programming language of your preference using the drop-down at the top.

Even if you are using a third party library like Alamofire, you can still copy some code, like headers and body parameters.

Let me know in comments if you find this useful.

Namit Gupta

Technical Lead iOS @ONEChampionship | Ex-SDE2 @ Halodoc, Ex-iOS Lead @ Vokal. ❤️ Swift, designing pixel-perfect UI and writing clean code. Check my portfolio here.

Leave a Reply