Sample code for 30+ languages & platforms
Swift

Transition from Imap.FetchSingle to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    // ...
    // ...

    // ------------------------------------------------------------------------
    // The FetchSingle method is deprecated:

    var emailObj: CkoEmail? = imap.fetchSingle(msgId: 1, bUid: false)
    if imap.lastMethodSuccess == false {
        print("\(imap.lastErrorText!)")
        return
    }

    // ...
    // ...

    emailObj = nil

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

    var headerOnly: Bool = false

    let email = CkoEmail()!
    success = imap.fetchEmail(headerOnly: headerOnly, msgId: 1, bUid: false, email: email)
    if success == false {
        print("\(imap.lastErrorText!)")
        return
    }


}