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

Transition from Imap.FetchBundleAsMime to Imap.FetchSingleBd

Provides instructions for replacing deprecated FetchBundleAsMime method calls with FetchSingleBd.

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 FetchBundleAsMime method is deprecated:

    var saObj: CkoStringArray? = imap.fetchBundle(asMime: mset)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    saObj = nil

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchSingleBd.

    imap.autoDownloadAttachments = true

    let bdMime = CkoBinData()!
    var bUid: Bool = mset.hasUids
    var numEmails: Int = mset.count.intValue
    var i: Int = 0
    while i < numEmails {
        success = imap.fetchSingleBd(msgId: mset.getId(index: i), bUid: bUid, mimeData: bdMime)
        //  ...
        //  ...

        i = i + 1
    }


}