Here's a sample code that shows how to send App ID and nonce headers in a URLSession request in Swift, and how to validate the response:
main.swift1352 chars42 lines
In the above code, we added the App ID and nonce headers to the URLSession configuration, so that they will be sent with every request sent using that configuration.
Then, we created a URL request with the desired URL and HTTP method (in this example, we used GET). We sent the request using a URLSession data task, and checked the response for errors and status code. Finally, we handled the valid and invalid responses accordingly.
gistlibby LogSnag