Front-End Web & Mobile

Introducing the AWS Amplify Library for Swift

The Amplify iOS team is announcing the release of version 2.0.0 of the Amplify Library for Swift. Please use this GitHub repo to inform the Amplify iOS team about features or issues, or visit the Amplify Discord server under the #swift-help channel.

Highlights

Below is a high-level breakdown of the features we are announcing with Amplify Library for Swift version 2.0.0 .

New Name

The Amplify Library for Swift is the new and improved version of Amplify iOS. This name change comes with the major improvements to the library, with the new support for macOS being a major deciding factor for the library no longer being referred to as Amplify iOS.

Full Swift Integration

The Amplify Library for Swift is now exclusively using Swift and is built on top of the AWS SDK for Swift. With this version, Swift developers will be able to debug and contribute to the underlying open-source codebase completely in Swift.

Structured Concurrency

Since the Amplify Library for Swift is now fully written in Swift, one of its most popular features has made its way into the Amplify APIs. Most of the APIs for the supported categories now have the ability to use the recently release concurrency feature, async/await. Before structured concurrency, You might have written your API calls with your logic in a callback like this:

func signIn(username: String, password: String) {
    Amplify.Auth.signIn(username: username, password: password) { result in
        switch result {
        case .success(let signInResult):
            if signInResult.isSignedIn {
                print("Sign in succeeded")
            }
        case .failure(let error):
            print("Sign in failed \(error)")
        }
    }
}

Now you’re able to write your Amplify calls like the code snippet below:

func signIn(username: String, password: String) async {
    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)")
    }
}

Developer Preview macOS Support

The iOS development community made it very clear that macOS support was the most important issue to address with Amplify. We listened! The Amplify Library for Swift now supports a developer preview version of Analytics, API, Auth, DataStore, Geo, and Storage for macOS development. You’ll also be able to take advantage of the structured concurrency features on macOS as well.

Other Notable Improvements

While there are plenty of improvements that have been added throughout the library, there are two that will considerably improve the developer experience with Amplify. First, adjustments to the underlying architecture improve the ability to debug some common workflows for Auth (sign-up/sign-in) and Storage (file upload/download). Second, removing calls to deprecated Apple APIs, making Amplify a warning-free dependency when added to your project.

In conclusion

We would love to have your feedback on this release and understand how we can help accelerate your productivity. Reach out on the GitHub repository, or through the Amplify Discord server under the #swift-help channel to help us prioritize features and enhancements.

To get started building iOS and/or macOS apps with Amplify, please visit the Amplify Library for Swift documentation.