How to Encode the & to %26 in Swift 4.1?
This is what I tried:
func encodeString(string: String) -> String {
let unreserved = "!@#$%^&*()_+<>?:,.;'*"
let allowed = NSMutableCharacterSet.symbol()
allowed.addCharacters(in: unreserved)
return string.addingPercentEncoding(withAllowedCharacters: allowed as CharacterSet)!
}