Previously known as AWS Amplify iOS, AWS Amplify for Swift now offers a rewritten API to support Swift async
/await
and make concurrency code more idiomatic. Additionally, the new release introduces beta support on macOS for a number of AWS features, including Auth, Storage, Geo, and others.
AWS Amplify for Swift is built on top of the AWS SDK for Swift, which is still only a developer preview. While insulating the developer from any changes in the underlying layer, AWS Amplify for Swift aims to provide a higher-level, declarative, and use-case centric API to access a number of AWS services, including Analytics, Authentication, DataStore, Geo, and Storage. Both REST and GraphQL are supported to access remote API data.
As mentioned, the most significant improvement in AWS Amplify for Swift is support for the new concurrency features introduced in Swift 5.5. Previous to version 2.0, AWS Amplify relied on a callback-based model for network and asynchronous operations. The adoption of async
/await
will make it easier for developers to write concurrent operations. For example, in the case of authentication:
do {
let signInResult = try await Amplify.Auth.signIn(username: username,
password: password)
if signInResult.isSignedIn {
print("Sign in succeeded")
}
} catch {
print("Sign in failed \(error)")
}
AWS Amplify 2.0 also provides better support for debugging authentication and upload/download workflows thanks to a number of architectural improvements. Furthermore, AWS engineers took the chance to remove all calls to obsolete APIs, which makes AWS Amplify a warning-free dependency.
AWS Amplify has a modular architecture, where each supported service is implemented through a plugin. This makes the library theoretically able to support alternative services using the same high-level API, although no additional plugins other than those required for AWS are available.
AWS Amplify for Swift is part of a larger collection of tools AWS offers for mobile iOS and Android app development, including a CLI tool used to configure all AWS services used by the app and a number of UI components for React, React Native, Angular, Vue, and Flutter.