I am working on an iOS app, which uses multiplatform Kotlin. I need to encode/decode a string into base64. I am able to encode a normal string with below code, but I am not able to decode a base 64 string into normal string. Below is my code.
fun encodeToBase64() {
var st: NSString = "normalString"
var data: NSData? = st.dataUsingEncoding(encoding =
NSUTF8StringEncoding)
if (data != null) {
var str = data.base64EncodedStringWithOptions(options = 0)
println("base 64 string == $str")
}
}
Thanks