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

Transition from Imap.FetchSequence to Imap.FetchRange

Provides instructions for replacing deprecated FetchSequence method calls with FetchRange.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    //  ...
    //  ...

    var startSeqNum: Int = 1
    var count: Int = 5

    //  ------------------------------------------------------------------------
    //  The FetchSequence method is deprecated:

    var bundleObj: CkoEmailBundle? = imap.fetchSequence(startSeqNum: startSeqNum, numMessages: count)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    bundleObj = nil

    //  ------------------------------------------------------------------------
    //  Do the equivalent using FetchRange.
    //  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.fetchRange(headersOnly: headersOnly, seqnum: startSeqNum, count: count, bundle: bundleOut)
    if success == false {
        print("\(imap.lastErrorText!)")
        return
    }


}