Sample code for 30+ languages & platforms
Swift Requires Chilkat v11.0.0+

Transition from Imap.Search to Imap.QueryMbx

Provides instructions for replacing deprecated Search method calls with QueryMbx.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    //  ...
    //  ...

    var criteria: String? = "FROM bob@example.com"
    var bUid: Bool = true

    //  ------------------------------------------------------------------------
    //  The Search method is deprecated:

    var msgSetObj: CkoMessageSet? = imap.search(criteria: criteria, bUid: bUid)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    msgSetObj = nil

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

    let mset = CkoMessageSet()!
    success = imap.queryMbx(criteria: criteria, bUid: bUid, msgSet: mset)
    if success == false {
        print("\(imap.lastErrorText!)")
        return
    }


}