I am having trouble converting the following curl to a url request in swift.
curl --location --request GET 'https://p52.pocket52.com/apis/v1?p={%22x%22:%22images%22,%22pl%22:{}}'
I Tried the following way, but I got Unexpectedly found nil while unwrapping an Optional value error
var request = URLRequest(url: URL(string: "https://p52.pocket52.com/apis/v1?p={%22x%22:%22images%22,%22pl%22:{}}")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
I tried with the solution present in this link Converting curl to URL request in Swift
but this is a POST curl it doesn't works for GET curl, Since GET request should not contains a body.
Let me define it more clearly, Basically I need to frame the following GET request.
https://p52.xxxx.com/apis/v1?p={"x":"images","pl":""}
We can achieve it by attaching a swift dictionary for a URLComponent part but, hear I am having a nested dictionary that's where I am facing difficulty.