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

Transition from Imap.FetchBundle to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchBundle method calls with FetchMsgSet.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    //  ...
    //  ...

    let mset = CkoMessageSet()!
    success = imap.queryMbx(criteria: "FROM joe@example.com", bUid: true, msgSet: mset)
    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The FetchBundle method is deprecated:

    var bundleObj: CkoEmailBundle? = imap.fetchBundle(messageSet: mset)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    bundleObj = nil

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

    var headersOnly: Bool = false

    let bundleOut = CkoEmailBundle()!
    success = imap.fetchMsgSet(headersOnly: headersOnly, msgSet: mset, bundle: bundleOut)
    if success == false {
        print("\(imap.lastErrorText!)")
        return
    }


}