Sample code for 30+ languages & platforms
Swift

Transition from Imap.ThreadCmd to Imap.QueryThread

Provides instructions for replacing deprecated ThreadCmd method calls with QueryThread.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    // ...
    // ...

    var threadAlg: String? = "REFERENCES"
    var charset: String? = "UTF-8"
    var searchCriteria: String? = "SUBJECT a"
    var bUid: Bool = true

    // ------------------------------------------------------------------------
    // The ThreadCmd method is deprecated:

    var jsonObj: CkoJsonObject? = imap.threadCmd(threadAlg: threadAlg, charset: charset, searchCriteria: searchCriteria, bUid: bUid)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    // ...
    // ...

    jsonObj = nil

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

    imap.searchCharset = "UTF-8"

    let json = CkoJsonObject()!
    success = imap.queryThread(threadAlg: threadAlg, searchCriteria: searchCriteria, bUid: bUid, json: json)
    if success == false {
        print("\(imap.lastErrorText!)")
        return
    }


}