Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.
Gen1 DocsLegacy

Page updated Sep 25, 2024

AWS SDK for S3 APIを使用する

Amplifyが機能を提供していない高度なユースケースの場合、エスケープハッチを取得してS3Clientインスタンスにアクセスできます。

以下のインポートを追加します。

import AWSS3StoragePlugin

次に、このコードを使用してエスケープハッチを取得します。

do {
// Retrieve the reference to AWSS3StoragePlugin
let plugin = try Amplify.Storage.getPlugin(for: "awsS3StoragePlugin")
guard let storagePlugin = plugin as? AWSS3StoragePlugin else {
return
}
// Retrieve the reference to S3Client
let s3Client = storagePlugin.getEscapeHatch()
// Make requests using s3Client...
// ...
} catch {
print("Get escape hatch failed with error - \(error)")
}

クライアント追加ドキュメントについては、AWS SDK for Swift クライアントドキュメントを参照してください。S3Clientコード例については、SDK for Swiftを使用したAmazon S3の例を参照してください。