Convert to string value for Base64 or URL.


Encode and decode string value to Base64.

// Encode
let utf8Data = "String".data(using: .utf8)
let base64String = utf8Data?.base64EncodedString()
// Decode
let base64Data = Data(base64Encoded: base64String)
let string = String(data: base64Data, encoding: .utf8)


Encode and decode string value to URL.

// Encode
"String".addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
// Decode
"String".removingPercentEncoding