Sample code for 30+ languages & platforms
Swift

Transition from Imap.FetchSingleHeader to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let imap = CkoImap()!

    // ...
    // ...

    // ------------------------------------------------------------------------
    // The FetchSingleHeader method is deprecated:

    var emailObj: CkoEmail? = imap.fetchSingleHeader(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 = true

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


}