Resolved: iOS Swift API URLQueryitem

In this post, we will see how to resolve iOS Swift API URLQueryitem

Question:

I am getting the url as : urlRequest=====https://jsonplaceholder.typicode.com/users/?id=1 The actual url : https://jsonplaceholder.typicode.com/users/1
I need to remove the ?id= How to remove this characters from this. Please help.
Thanks in advance.

Best Answer:

URLQueryItem adds the question mark which represents the query separator.
This REST URL doesn’t use URL query so URLQueryItem is not needed at all. Add the user ID with String Interpolation.
URLRequest is not needed either, GET is the default and you don’t use a special configuration

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com