Swift 3: utilidad de transferencia enumerateToAssignBlocks signature del método

Los documentos oficiales de AWS contienen el siguiente código objective c

AWSS3TransferUtility *transferUtility = [AWSS3TransferUtility defaultS3TransferUtility]; [transferUtility enumerateToAssignBlocksForUploadTask:^(AWSS3TransferUtilityUploadTask *uploadTask, __autoreleasing AWSS3TransferUtilityUploadProgressBlock *uploadProgressBlockReference, __autoreleasing AWSS3TransferUtilityUploadCompletionHandlerBlock *completionHandlerReference) { NSLog(@"%lu", (unsigned long)uploadTask.taskIdentifier); // Use `uploadTask.taskIdentifier` to determine what blocks to assign. *uploadProgressBlockReference = // Reassign your progress feedback block. *completionHandlerReference = // Reassign your completion handler. } downloadTask:^(AWSS3TransferUtilityDownloadTask *downloadTask, __autoreleasing AWSS3TransferUtilityDownloadProgressBlock *downloadProgressBlockReference, __autoreleasing AWSS3TransferUtilityDownloadCompletionHandlerBlock *completionHandlerReference) { NSLog(@"%lu", (unsigned long)downloadTask.taskIdentifier); // Use `downloadTask.taskIdentifier` to determine what blocks to assign. *downloadProgressBlockReference = // Reassign your progress feedback block. *completionHandlerReference = // Reassign your completion handler. }]; 

Traté de convertirlo en Swift 3 (tarea de carga solamente)

 transferUtility.enumerateToAssignBlocks(forUploadTask: { let progressPointer = AutoreleasingUnsafeMutablePointer<AWSS3TransferUtilityUploadProgressBlock?>(&uploadProgressBlock) let completionPointer = AutoreleasingUnsafeMutablePointer<AWSS3TransferUtilityUploadCompletionHandlerBlock?>(&completionBlock) progress = progressPointer completion = completionPointer } , downloadTask: nil) 

Pero Xcode arroja el siguiente error

No se puede convertir el valor de tipo () -> () al tipo de argumento esperado […]

¿Alguien lo consiguió en Swift 3? Probablemente las firmas de método hayan cambiado

EDITAR:

Solicité la respuesta @donkon:

  transferUtility.enumerateToAssignBlocks(forUploadTask: { (uploadTask:AWSS3TransferUtilityUploadTask, progress:AutoreleasingUnsafeMutablePointer<(@convention(block) (AWSS3TransferUtilityTask, Progress) -> Void)?>?, error: AutoreleasingUnsafeMutablePointer<(@convention(block) (AWSS3TransferUtilityUploadTask, Error?) -> Void)?>?) in let progressPointer = AutoreleasingUnsafeMutablePointer<AWSS3TransferUtilityProgressBlock?>(&self.progressBlock) let completionPointer = AutoreleasingUnsafeMutablePointer<AWSS3TransferUtilityUploadCompletionHandlerBlock?>(&self.completionHandler) // progress = progressPointer completion = completionPointer }, downloadTask: nil) 

ahora Xcode dice que tanto el progreso como la finalización se dejan valores y no se pueden cambiar.

El método que está tratando de usar tiene arguments que son funciones. Estas funciones en el SDK están escritas en Objective-C. Por lo tanto, debe usar @convention(block) para indicar que son references de bloques compatibles con Objective-C.

 AWSS3TransferUtility.default().enumerateToAssignBlocks(forUploadTask: { (uploadTask:AWSS3TransferUtilityUploadTask, uploadProgressBlockReference:AutoreleasingUnsafeMutablePointer<(@convention(block) (AWSS3TransferUtilityTask, Progress) -> Void)?>?, completionHandlerReference: AutoreleasingUnsafeMutablePointer<(@convention(block) (AWSS3TransferUtilityUploadTask, Error?) -> Void)?>?) in print("Hello, world") uploadProgressBlockReference?.pointee = {(task:AWSS3TransferUtilityTask, progress:Progress) -> Void in print("Fraction completed: \(progress.fractionCompleted)") } }, downloadTask: nil)