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

Transition from Imap.ListMailboxes to Imap.MbxList

Provides instructions for replacing deprecated ListMailboxes method calls with MbxList.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    //  ...
    //  ...

    var reference: String? = ""
    var mbxPattern: String? = "*"

    //  ------------------------------------------------------------------------
    //  The ListMailboxes method is deprecated:

    //  Lists all mailboxes, including unsubscribed.
    var mboxesObj: CkoMailboxes? = imap.listMailboxes(reference: reference, wildcardedMailbox: mbxPattern)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    //  ...
    //  ...

    mboxesObj = nil

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

    //  Lists all mailboxes, including unsubscribed.
    var subscribed: Bool = false

    let mboxes = CkoMailboxes()!
    success = imap.mbxList(subscribed: subscribed, reference: reference, mbxPattern: mbxPattern, mboxes: mboxes)
    if success == false {
        print("\(imap.lastErrorText!)")
        return
    }


}