Sample code for 30+ languages & platforms
Swift

Transition from Crypt2.LastJsonData to Crypt2.GetLastJsonData

Provides instructions for replacing deprecated LastJsonData method calls with GetLastJsonData.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let crypt2 = CkoCrypt2()!

    // ...
    // ...

    // ------------------------------------------------------------------------
    // The LastJsonData method is deprecated:

    var jsonObj: CkoJsonObject? = crypt2.lastJsonData()
    if crypt2.lastMethodSuccess == false {
        print("\(crypt2.lastErrorText!)")
        return
    }

    // ...
    // ...

    jsonObj = nil

    // ------------------------------------------------------------------------
    // Do the equivalent using GetLastJsonData.
    // Your application creates a new, empty JsonObject object which is passed 
    // in the last argument and filled upon success.

    let jsonOut = CkoJsonObject()!
    crypt2.getLastJsonData(json: jsonOut)
    if success == false {
        print("\(crypt2.lastErrorText!)")
        return
    }


}