I have a URL
that takes any String
like this:
https://test@api.search?query=\(productSearchString)&limit=1
Now my problem is that this works with for example "iphone" but it crashes with "iphone 12". I tried encoding it like this:
guard let escapedResourceString = resourceString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else { return }
but this doesn't seem to work in my case because it is returning an incorrect URL
that I can not use with my API.
How can I fix this, so the user can type in anything he want but the URL
should be created and my API should be able to work with it.
If you need anything more just let me know.