So currently I am using this method (in swift) below to get images from my S3 bucket, which works good:
static var completionHandler: AWSS3TransferUtilityDownloadCompletionHandlerBlock?
static var MY_BUCKET = "BUCKET_NAME"
let transferUtility = AWSS3TransferUtility.default()
class func downloadFromS3(key: String, completion: @escaping (_ image: UIImage?, _ error: Error?)-> Void){
let credentialsProvider = AWSCognitoCredentialsProvider(regionType:.USEast1,identityPoolId:POOL_ID)
let configuration = AWSServiceConfiguration(region:.USEast1, credentialsProvider:credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
let transferUtility = AWSS3TransferUtility.default()
let expression = AWSS3TransferUtilityDownloadExpression()
transferUtility.downloadData(fromBucket: MY_BUCKET, key: key, expression: expression) { (task, url, data, error) in
var resultImage: UIImage?
if let data = data {
resultImage = UIImage(data: data)
}
completion(resultImage, error)
}
}
the only problem is that it takes about 5 to 10 seconds to get the image. is there a faster method of getting the images? In Android, there is the Glide library which works perfectly. Is there a library as functional as that in iOS?