Page updated Jan 16, 2024

Use AWS SDK

For advanced use cases where Amplify does not provide the functionality, you can retrieve the escape hatch to access the underlying Amazon Pinpoint client.

Note: While the Amplify Library for Swift is production ready, please note that the underlying AWS SDK for Swift is currently in Developer Preview, and is not yet intended for production workloads. Here is additional reading material on the stability of the SDK

Add the following import:

1import AWSPinpointAnalyticsPlugin

Then retrieve the escape hatch with this code:

1do {
2 // Retrieve the reference to AWSPinpointAnalyticsPlugin
3 let plugin = try Amplify.Analytics.getPlugin(for: "awsPinpointAnalyticsPlugin")
4 guard let analyticsPlugin = plugin as? AWSPinpointAnalyticsPlugin else {
5 return
6 }
7
8 // Retrieve the reference to PinpointClientProtocol
9 let pinpointClient = analyticsPlugin.getEscapeHatch()
10
11 // Make requests using pinpointClient...
12 // ...
13} catch {
14 print("Get escape hatch failed with error - \(error)")
15}