Sample code for 30+ languages & platforms
Swift

Transition from Imap.FetchHeaders to Imap.FetchMsgSet

Provides instructions for replacing deprecated FetchHeaders 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 FetchHeaders method is deprecated:

    var bundleObj: CkoEmailBundle? = imap.fetchHeaders(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 = true

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


}