0

I'm trying to update a progress view as I upload an asset to an S3 bucket like so:

myTransferManager.upload(myTransferManagerRequest).continueWithExecutor(myDefaultThreadBFExecutor, withBlock: { (myBFTask) -> AnyObject! in ... etc etc. 

However, I can't figure out how to get the completion percentage of the request as it uploads. I have come across this delegate method a few times:

-(void)request:(AmazonServiceRequest *)request didSendData:(NSInteger)bytesWritten     totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:    (NSInteger)totalBytesExpectedToWrite
{

}

But my project is written in Swift and I haven't been able to figure out how to implement this. For reference, I came across that method here: http://mobile.awsblog.com/post/TxIRFEQTW9XU8G/S3TransferManager-for-iOS-Part-I-Asynchronous-Uploads and here: Uploading to Amazon-S3 via AFNetworking

any tips would be greatly appreciated!

Cheers, Brendan

Community
  • 1
  • 1
bkopp
  • 478
  • 1
  • 8
  • 20

1 Answers1

1

AWSRequest, which is a parent class of all AWS request objects, has properties called uploadProgress and downloadProgress. You can use them to track the progress.

Yosuke
  • 3,759
  • 1
  • 11
  • 21