I am attempting to upload directly to s3 using alamofire (my app has to run on the apple watch and the aws-ios-sdk does not work on the apple watch). I know I have to sign the url but am at a loss of how to directly form the request given a url. However, my current approach seems to do nothing of the sort. I have found several similar questions that don't seem to address upload with alamofire directly to s3, end to end, including signing a url with access keys and secrets.
code
class UploadUtil
public func upload(file: URL, key: String, success: @escaping ()->()) {
let access_key = "AKIA123453435242"
let secret = "abcdefghijklmnopqrstuvwxyz"
Alamofire.upload(
multipartFormData: { multipartFormData in
multipartFormData.append(unicornImageURL, withName: "unicorn")
multipartFormData.append(rainbowImageURL, withName: "rainbow")
},
to: "https://mybucket.s3.amazonaws.com",
encodingCompletion: { encodingResult in
switch encodingResult {
case .success(let upload, _, _):
upload.responseJSON { response in
debugPrint(response)
}
case .failure(let encodingError):
print(encodingError)
}
}
)
}
}