Check out example codes for "urlencode string swift". It will help you in understanding the concepts better.

Code Example 1

let originalString = "test/test"
let escapedString = originalString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
print(escapedString!)

Learn ReactJs, React Native from akashmittal.com