(Swift) Transition from SFtp.ReadDir to SFtp.ReadDirListing
Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing. Note: This example requires Chilkat v11.0.0 or greater.
func chilkatTest() {
var success: Bool = false
let sftp = CkoSFtp()!
// ...
// ...
// ------------------------------------------------------------------------
// The ReadDir method is deprecated:
var dirObj: CkoSFtpDir? = sftp.readDir()
if sftp.lastMethodSuccess == false {
print("\(sftp.lastErrorText!)")
return
}
// ...
// ...
dirObj = nil
// ------------------------------------------------------------------------
// Do the equivalent using ReadDirListing.
// Your application creates a new, empty SFtpDir object which is passed
// in the last argument and filled upon success.
let dirOut = CkoSFtpDir()!
success = sftp.readDirListing(dirOut)
if success == false {
print("\(sftp.lastErrorText!)")
return
}
}
|