Sample code for 30+ languages & platforms
Swift

Example: Crypt2.DecodeString method

Demonstrates how to call the DecodeString method.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    let crypt2 = CkoCrypt2()!

    // The string "Hello World" in base64 (using the utf-8 byte representation) is "SGVsbG8gV29ybGQ="

    var encodedStr: String? = "SGVsbG8gV29ybGQ="
    var encoding: String? = "base64"
    var charset: String? = "utf-8"

    var str: String? = crypt2.decodeString(inStr: encodedStr, charset: charset, encoding: encoding)
    print("\(str!)")

    // Output is "Hello World"

}