IDN Media Bevan Christian Oct 3, 2023

GraphQL Integration with AWS Amplify in Swift for iOS

Article Summary

Bevan Christian from IDN Engineering just cut through months of AWS Amplify confusion. His approach skips 60% of the official setup steps while keeping full GraphQL power.

Most iOS developers struggle with AWS Amplify's documentation because it assumes a monolithic structure where frontend and backend live together. Bevan shows how to integrate Amplify GraphQL into Swift apps when your backend team handles resources separately, eliminating unnecessary complexity.

Key Takeaways

Critical Insight

You only need GraphQL query extensions, an optional config file, and request implementations instead of the full monolithic setup Amplify documentation prescribes.

The article includes production-ready code for handling token refresh and real-time subscriptions that most tutorials completely skip.

About This Article

Problem

iOS developers using AWS Amplify GraphQL often end up with bloated project structures when they follow the official documentation. The setup combines frontend and backend into one monolithic codebase, forcing developers to add nearly 20 files that have nothing to do with their actual frontend work.

Solution

Bevan Christian shows a simpler way to do this. Instead of using code generation, you write GraphQL queries manually with JSONValue return types. Amplify can be initialized with either a custom APICategoryConfiguration or just a basic amplifyconfiguration.json file.

Impact

This approach cuts down on complexity. You skip the AWS CLI, schema configuration, and automatic code generation steps entirely. iOS developers can still use the full range of GraphQL features like queries, mutations, and subscriptions. All it takes is three additions: query extensions, an optional config file, and request implementations.