{"id":13532085,"url":"https://github.com/awslabs/aws-mobile-appsync-sdk-ios","last_synced_at":"2025-05-15T10:02:57.921Z","repository":{"id":27083691,"uuid":"108313472","full_name":"awslabs/aws-mobile-appsync-sdk-ios","owner":"awslabs","description":"iOS SDK for AWS AppSync.","archived":false,"fork":false,"pushed_at":"2024-11-04T14:44:21.000Z","size":75122,"stargazers_count":267,"open_issues_count":0,"forks_count":134,"subscribers_count":55,"default_branch":"main","last_synced_at":"2025-05-09T23:39:56.797Z","etag":null,"topics":["appsync","appsync-sdk","aws","aws-mobile","cocoapods","codegen","graphql","graphql-client","graphql-ios","graphql-subscriptions","ios","ios-appsync","ios-client","ios-swift"],"latest_commit_sha":null,"homepage":"https://awslabs.github.io/aws-mobile-appsync-sdk-ios/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awslabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-25T19:03:00.000Z","updated_at":"2025-05-02T00:03:38.000Z","dependencies_parsed_at":"2024-04-23T01:28:32.933Z","dependency_job_id":"f0274a93-1a82-4f13-a249-f6a3ca817c07","html_url":"https://github.com/awslabs/aws-mobile-appsync-sdk-ios","commit_stats":{"total_commits":472,"total_committers":55,"mean_commits":8.581818181818182,"dds":0.8093220338983051,"last_synced_commit":"cd8af3d8e6acf79c32ca595740967f412df63c45"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-mobile-appsync-sdk-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-mobile-appsync-sdk-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-mobile-appsync-sdk-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-mobile-appsync-sdk-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awslabs","download_url":"https://codeload.github.com/awslabs/aws-mobile-appsync-sdk-ios/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319716,"owners_count":22051072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appsync","appsync-sdk","aws","aws-mobile","cocoapods","codegen","graphql","graphql-client","graphql-ios","graphql-subscriptions","ios","ios-appsync","ios-client","ios-swift"],"created_at":"2024-08-01T07:01:08.090Z","updated_at":"2025-05-15T10:02:50.951Z","avatar_url":"https://github.com/awslabs.png","language":"Swift","funding_links":[],"categories":["AppSync GraphQL Clients"],"sub_categories":[],"readme":"# ⚠️ AWS AppSync SDK for iOS is in Maintenance Mode\n\nFor more information, including how to upgrade to using AWS Amplify API Category, see [AWS Amplify \u003e API (GraphQL) \u003e Upgrade guide from AppSync SDK](https://docs.amplify.aws/lib/graphqlapi/upgrade-guide/q/platform/ios/)\n## Recommendation: Use [Amplify](https://aws-amplify.github.io/) clients to connect to AppSync\n\nFor front-end web and mobile development, we recommend using the [Amplify](https://aws-amplify.github.io/) clients which are optimized to connect to the AppSync backend.\n\n- For DynamoDB data sources, use the [DataStore](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/ios/) category in the Amplify client. It provides the best developer experience and built-in conflict detection and resolution.\n- For non-DynamoDB data sources in scenarios where you have no offline requirements, use the [API (GraphQL)](https://docs.amplify.aws/lib/graphqlapi/getting-started/q/platform/ios/) category in the Amplify client.\n\nAWS AppSync SDK for iOS\n=======================\n\n[![Release](https://img.shields.io/github/release/awslabs/aws-mobile-appsync-sdk-ios.svg)](https://github.com/awslabs/aws-mobile-appsync-sdk-ios/releases)\n[![CocoaPods](https://img.shields.io/cocoapods/v/AWSAppSync.svg)](https://github.com/CocoaPods/CocoaPods)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Build Status](https://travis-ci.org/awslabs/aws-mobile-appsync-sdk-ios.svg?branch=main)](https://travis-ci.org/awslabs/aws-mobile-appsync-sdk-ios)\n[![Documentation Status](https://readthedocs.org/projects/ansicolortags/badge/?version=latest)](https://aws-amplify.github.io/docs/ios/api/)\n[![Swift](https://img.shields.io/badge/swift-5-orange.svg?style=flat)](https://developer.apple.com/swift/)\n[![Twitter Follow](https://img.shields.io/twitter/follow/AWSforMobile.svg?style=social\u0026label=Follow)](https://twitter.com/AWSforMobile)\n\n\nThe AWS AppSync SDK for iOS enables you to access your AWS AppSync backend and perform operations like `Queries`, `Mutations`, and `Subscriptions`. The SDK also includes support for offline operations. This SDK is based off of the Apollo project found [here](https://github.com/apollographql/apollo-ios). Please log questions for this client SDK in this repo and questions for the AppSync service in the [official AWS AppSync forum](https://forums.aws.amazon.com/forum.jspa?forumID=280\u0026start=0).\n\n## Setup\n\n\u003e Note: AWS AppSync uses Swift 5.1. Use Xcode 11.0 or greater to build.\n\n### Installing the SDK\n\n#### Via Swift Package Manager\n\n1. Swift Package Manager is distributed with Xcode. To start adding the AWS SDK to your iOS project, open your project in Xcode and select **File \u003e Swift Packages \u003e Add Package Dependency**.\n\n1. Enter the URL for the AWS AppSync SDK for iOS GitHub repo (`https://github.com/awslabs/aws-mobile-appsync-sdk-ios`) into the search bar and click **Next**.\n\n1. You'll see the repository rules for which version of the SDK you want Swift Package Manager to install. Choose the first rule, **Version**, and select **Up to Next Major** as it will use the latest compatible version of the dependency that can be detected from the `main` branch, then click **Next**.\n\n1. Choose the **AWSAppSync** package product and click **Finish**.\n\n1. In your source file, import the SDK using `import AWSAppSync`.\n\n#### Via CocoaPods\n\n1. Add the following line to your Podfile:\n\n    ```ruby\n    pod 'AWSAppSync', '~\u003e 3.7.1'\n    ```\n\n    Example:\n\n    ```ruby\n    # Uncomment the next line to define a global platform for your project\n    # platform :ios, '9.0'\n\n    target 'EventsApp' do\n      # Comment the next line if you're not using Swift and don't want to use dynamic frameworks\n      use_frameworks!\n\n      # Pods for EventsApp\n      pod 'AWSAppSync', '~\u003e 3.7.1'\n    end\n    ```\n\n1. Run `pod install` to install the AppSync SDK, then open the **`.xcworkspace`** file (not the `.xcodeproj` file) in Xcode.\n\n1. Now **Build** your project to start using the SDK. Whenever a new version of the SDK is released you can update by running `pod update` and rebuilding your project to use the new features.\n\n1. In your source file, import the SDK using `import AWSAppSync`.\n\n#### Via Carthage\n\n##### XCFrameworks (recommended)\n\nCarthage supports XCFrameworks in Xcode 12 or above. Follow the steps below to consume the AWS SDK for iOS using XCFrameworks:\n\n1. Install Carthage 0.37.0 or greater.\n\n2. Add the following to your `Cartfile`:\n\n    ```\n    github \"awslabs/aws-mobile-appsync-sdk-ios\"\n    ```\n\n3. Then run the following command:\n\n        $ carthage update --use-xcframeworks\n\n4. On your application targets’ General settings tab, in the Embedded Binaries section, drag and drop each xcframework you want to use from the Carthage/Build folder on disk.\n\n\u003e Note: If you are using XCFrameworks (i.e., either Carthage or Dynamic Frameworks), the module `AWSMobileClient` is named as `AWSMobileClientXCF` to work around a [Swift issue](https://bugs.swift.org/browse/SR-11704). To use `AWSMobileClient`, import it as:\n\n        import AWSMobileClientXCF\n\nand use it your app code without the `XCF` suffix.\n\n        AWSMobileClient.default.initialize()\n\n##### Frameworks with \"fat libraries\" (not recommended)\n\nTo build platform-specific framework bundles with multiple architectures in the binary, (Xcode 11 and below)\n\n1. Add the following to your Cartfile:\n\n    ```\n    github \"awslabs/aws-mobile-appsync-sdk-ios\"\n    ```\n\n1. Once complete, run `carthage update` and open the `*.xcworkspace` with Xcode and chose your `Target`. In the `General` tab, find `Embedded Binaries`, then choose the `+` button.\n\n1. Choose the `Add Other` button, navigate to the `AWS\u003c#ServiceName#\u003e.framework` files under `Carthage \u003e Build \u003e iOS` and select `AWSAppSync.framework` and its required dependencies:\n\n    * AWSAppSync.framework\n    * AWSCore.framework\n    * Reachability.framework\n    * SQLite.framework\n    * AppSyncRealTimeClient.framework\n    * Starscream.framework\n\n    Do not select the `Destination: Copy items` if needed check box when prompted.\n\n1. Under the `Build Phases` tab in your `Target`, choose the `+` button on the top left and then select `New Run Script Phase`. Setup the build phase as follows. Make sure this phase is below the Embed Frameworks phase.\n\n    ```bash\n    bash \"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSCore.framework/strip-frameworks.sh\"\n    ```\n\n    Options:\n    * **Shell**: /bin/sh\n    * **Show environment variables in build log**: Checked\n    * **Run script only when installing**: Not checked\n    * **Input Files**: Empty\n    * **Output Files**: Empty\n\n1. Now **Build** your project to start using the SDK. Whenever a new version of the SDK is released you can update by running `carthage update` and rebuilding your project to use the new features.\n\n    \u003e Note: Currently, the AWSAppSync SDK for iOS builds the Carthage binaries using Xcode 12.0. To consume the pre-built binaries your Xcode version needs to be the same. Otherwise you will have to build the frameworks on your machine by passing `--no-use-binaries` flag to `carthage update` command.\n\n1. In your source file, import the SDK using `import AWSAppSync`.\n\n### Codegen\n\nTo use the AppSync SDK, you will need to use `amplify codegen` from the [AWS Amplify CLI](https://aws-amplify.github.io/docs/cli/codegen?sdk=ios). This command will generate Swift-language files corresponding to your schema. You can interact with these classes instead of operating on GraphQL query documents, directly. You can find the instructions to use the codegen [here](https://aws-amplify.github.io/docs/ios/api).\n\n## Sample\n\nYou can find a sample app which uses the AppSync SDK here: https://github.com/aws-samples/aws-mobile-appsync-events-starter-ios\n\n## Documentation\n\nYou can find a step by step walk through of setting up codegen backend and accessing it via the iOS client here: https://docs.amplify.aws/sdk/api/graphql/q/platform/ios\n\n\n## Contributing\n\nContributing guidelines are noted [here](https://github.com/awslabs/aws-mobile-appsync-sdk-ios/blob/main/CONTRIBUTING.md).\n\n## Testing Contributions\n\nIf you are contributing to the SDK, it is recommended to add some unit and/or integration tests and evaluate against existing tests.\n\n### Invoking tests\n\nThe `AWSAppSync` target is configured to run both Unit and Integration tests in its `Test` configuration. After completing integration test setup following the instructions below, you can run both suites by invoking \"Product \u003e Test\" (⌘-U) in Xcode.\n\nTo run only one suite of tests (Unit or Integration), select the appropriate target from the Scheme selector and invoke \"Product \u003e Test\" (⌘-U). While Unit tests run much faster than Integration tests, we recommend running both before submitting a PR.\n\n### Setting up unit tests\n\nUnit Tests do not require any specific setup and can be run directly from your Xcode IDE.\n  - NOTE: Currently, any test that requires network activity is placed in Integration tests, even if the test hits localhost and not a valid service.\n\n### Setting up integration tests\n\nTo run integration tests, you will need the following:\n- Two AppSync API instances with an `Posts` schema.\n  - The first AppSync instance should be configured to use a Cognito Identity Pool with unauthenticated identities supported.\n    - The Cognito Identity Pool's unauth role should have the `AppSync Invoke Full Access` permission.\n  - The second instance should be configured to use API Key authentication.\n\nYou can get the backend setup by following the steps below:\n\n1. Create a stack with an AppSync API using API Key authentication\n    1. Go to the [AWS CloudFormation console](https://console.aws.amazon.com/cloudformation/home).\n    1. Click on __Create stack__ and then select __Upload a template file__. Click __Choose File__, and navigate to the Cloud Formation Template in this project: `AWSAppSyncIntegrationTests/ConsoleResources/appsync-integrationtests-cloudformation.yaml`\n    1. Click __Next__\n    1. Type a \"Stack name\" and a \"ResourceNamePrefix\"\n        - We recommend using a \"ResourceNamePrefix\" that makes it easy to tell that the stack is used for AppSync tests, such as `AppSyncTest\u003cYYYYMMDDHHMM\u003e`.\n        - Because you will create two stacks for these tests, one using API Key authentication and one using IAM (Cognito Identity) authentication, we recommend selecting a stack name that makes it easy to differentiate between the two, such as `AppSyncTest\u003cYYYYMMDDHHMM\u003e-APIKey` and `AppSyncTest\u003cYYYYMMDDHHMM\u003e-IAM`.\n    1. Select the `ApiKey` Auth Type\n    1. Once the stack is complete, click on the __Output__ tab.\n    1. Copy the appropriate values to the test configuration file `AppSyncIntegrationTests/appsync_test_credentials.json`:\n        - `AppSyncApiKey`\n        - `AppSyncEndpointAPIKey`\n        - `AppSyncEndpointAPIKeyRegion`\n1. Create another CloudFormation Stack following steps 1-6 above, but select the \"IAM\" Auth Type in step 5.\n    1. Copy the appropriate values to the test configuration file `AppSyncIntegrationTests/appsync_test_credentials.json`:\n        - `AppSyncEndpoint`\n        - `AppSyncRegion`\n        - `CognitoIdentityPoolId`\n        - `CognitoIdentityPoolRegion`\n        - `BucketName`\n        - `BucketRegion`\n        - `AppSyncMultiAuthAPIKey`\n1. Create another CloudFormation Stack following step 1-6 above with `API Key` as the Auth type (we'll change that later)\n   1. Create a Lambda function using the template provided in this project at `AWSAppSyncIntegrationTests/ConsoleResources/appsync-lambda-authorize\nr.js`\n   1. Once the stack is complete click on the __Outputs__ tab\n   1. Copy the appropriate values to the test configuration file `AppSyncIntegrationTests/appsync_test_credentials.json`:\n        - `AppSyncEndpointAPIKeyLambda`\n        - `AppSyncEndpointAPIKeyLambdaRegion`\n\n   1. Go to the [AWS AppSync console](https://console.aws.amazon.com/appsync/home), select the newly created AppSync instance\n   1. In the `Settings` section, change the default authentication type to `AWS Lambda` and select the Lambda function created at the previous step\n\n\u003e Note: You must either provide all values in the `AppSyncIntegrationTests/appsync_test_credentials.json` or in code. There is no mechanism to handle partial overrides of one source with the other. All values must be specified before running the integration tests.\n\n__Option 1: Use a test configuration file__\n\nAdd a file `appsync_test_credentials.json` (see sample below) in the `AWSAppSyncIntegrationTests` folder and replace the values for `AppSyncEndpoint`,  `CognitoIdentityPoolId`, `AppSyncEndpointAPIKey`, `AppSyncAPIKey` and regions if required:\n\n```json\n{\n  \"AppSyncEndpoint\": \"https://iambasedendpoint.appsync-api.us-east-1.amazonaws.com/graphql\",\n  \"AppSyncRegion\": \"us-east-1\",\n  \"CognitoIdentityPoolId\": \"us-east-1:abcd1234-1234-12324-b4b7-aaa0c0831234\",\n  \"CognitoIdentityPoolRegion\": \"us-east-1\",\n  \"AppSyncEndpointAPIKey\": \"https://apikeybasedendpoint.appsync-api.us-east-1.amazonaws.com/graphql\",\n  \"AppSyncEndpointAPIKeyRegion\": \"us-east-1\",\n  \"AppSyncAPIKey\": \"da2-sad3lkh23422\",\n  \"BucketName\": \"bucketName\",\n  \"BucketRegion\": \"us-east-1\",\n  \"AppSyncMultiAuthAPIKey\": \"da2-sd34s5ffxz\"\n}\n```\n\n\u003e Note: The `AppSyncEndpointAPIKey` endpoint uses `API_KEY` based auth, while `AppSyncEndpoint` uses the `AWS_IAM` based auth.\n\n__Option 2: Edit defaults in source code__\n\nEdit the file `AWSAppSyncTestCommon/AppSyncClientTestConfigurationDefaults` with appropriate values.\n\nNow you should be able to run the integration tests by invoking \"Product \u003e Test\" (⌘-U) in Xcode.\n\n## License\n\nThis library is licensed under the [Amazon Software License](https://aws.amazon.com/asl/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Faws-mobile-appsync-sdk-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawslabs%2Faws-mobile-appsync-sdk-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Faws-mobile-appsync-sdk-ios/lists"}