Sending an HTTP POST request to an API using Swift

Hi, I'm trying to send a POST request within Swift and I cannot get it to work properly. I can send a generic GET request that seems to work fine but a POST request is giving me no end of grief.

This is what I have which works perfectly fine as a GET request.

guard let url = URL(string: "") else {

URLSession.shared.dataTask(with: url) { (data, response, error) in
	let collection = try! JSONDecoder().decode(APIResponse.self, from: data!)

However, I need to send a POST request with two parameters; email and id but all of the tutorials and questions I've searched through on Google are just too complicated and go way over my head. I'm hoping someone can explain clearly how I can achieve this?

Create an instance of URLRequest, which encapsulates the URL, http method, and body of a request (among other things), and pass it into URLSession.dataTask(with:completionHandler:).

Simple example used in an async function to post JSON content from a message which is Codable:

      let url = URL(string: address)!
      var request = URLRequest(url: url)
      request.setValue("application/json", forHTTPHeaderField: "Content-Type")
      request.httpMethod = "POST"
      let encoder = JSONEncoder()
      let data = try encoder.encode(message)
      request.httpBody = data

      let (responseData, response) = try await URLSession.shared.upload(for: request, from: data, delegate: self)
      // etc...