Swift
Swift
Transition from Imap.FetchChunk to Imap.FetchRange
Provides instructions for replacing deprecated FetchChunk method calls with FetchRange.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let imap = CkoImap()!
// ...
// ...
var startSeqNum: Int = 1
var count: Int = 5
let failedSet = CkoMessageSet()!
let fetchedSet = CkoMessageSet()!
// ------------------------------------------------------------------------
// The FetchChunk method is deprecated:
var bundleObj: CkoEmailBundle? = imap.fetchChunk(startSeqNum: startSeqNum, count: count, failedSet: failedSet, fetchedSet: fetchedSet)
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
}
}