Sample code for 30+ languages & platforms
Swift

Yousign: Download File

See more Yousign Examples

Downloads a previously uploaded Yousign file.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()!

    // Adds the "Authorization: Bearer YOUR_API_KEY" header.
    http.authToken = "YOUR_API_KEY"

    var downloadUrl: String? = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media"
    var localFilePath: String? = "qa_output/x.pdf"

    success = http.download(url: downloadUrl, saveToPath: localFilePath)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("The PDF file is downloaded...")

}