Use AWS SDK
If you need functionality in the AWS services used by the Amplify Predictions category that isn't available, we provide an escape hatch so you can get a reference to that service. For example, to get a reference to AWSRekognition
:
1guard let predictionsPlugin = try Amplify.Predictions.getPlugin(for: "awsPredictionsPlugin") as? AWSPredictionsPlugin else {2 print("Unable to cast to AWSPredictionsPlugin")3 return4}5
6let rekognitionClient = predictionsPlugin.getEscapeHatch(key: .rekognition)7let request = CreateCollectionInput()8let output = try await rekognitionClient.createCollection(input: request)
In addition to AWSRekognition
, this same pattern can be used to get access to AWSTranslate
, AWSPolly
, AWSTranscribeStreaming
, AWSComprehend
, and AWSTextract
. For example:
1let translateClient = predictionsPlugin.getEscapeHatch(key: .translate)2let pollyClient = predictionsPlugin.getEscapeHatch(key: .polly)3let comprehendClient = predictionsPlugin.getEscapeHatch(key: .comprehend)4let textractClient = predictionsPlugin.getEscapeHatch(key: .textract)
API Documentation Resources