https://github.com/awslabs/aws-mobile-appsync-sdk-ios

iOS SDK for AWS AppSync.

https://github.com/awslabs/aws-mobile-appsync-sdk-ios

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 50 committers (2.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

appsync appsync-sdk aws aws-mobile cocoapods codegen graphql graphql-client graphql-ios graphql-subscriptions ios ios-appsync ios-client ios-swift

Keywords from Contributors

interactive archival projection generic sequences observability autograding hacking shellcodes modular
Last synced: 5 months ago · JSON representation

Repository

iOS SDK for AWS AppSync.

Basic Info
Statistics
  • Stars: 267
  • Watchers: 54
  • Forks: 134
  • Open Issues: 0
  • Releases: 71
Archived
Topics
appsync appsync-sdk aws aws-mobile cocoapods codegen graphql graphql-client graphql-ios graphql-subscriptions ios ios-appsync ios-client ios-swift
Created over 8 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Codeowners

README.md

⚠️ AWS AppSync SDK for iOS is Deprecated.

For more information, including how to upgrade to using AWS Amplify API Category, see AWS Amplify > API (GraphQL) > Upgrade guide from AppSync SDK

Recommendation: Use Amplify clients to connect to AppSync

For front-end web and mobile development, we recommend using the Amplify clients which are optimized to connect to the AppSync backend.

  • For DynamoDB data sources, use the DataStore category in the Amplify client. It provides the best developer experience and built-in conflict detection and resolution.
  • For non-DynamoDB data sources in scenarios where you have no offline requirements, use the API (GraphQL) category in the Amplify client.

AWS AppSync SDK for iOS

Release CocoaPods Carthage compatible Build Status Documentation Status Swift Twitter Follow

The 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. Please log questions for this client SDK in this repo and questions for the AppSync service in the official AWS AppSync forum.

Setup

Note: AWS AppSync uses Swift 5.1. Use Xcode 11.0 or greater to build.

Installing the SDK

Via Swift Package Manager

  1. 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 > Swift Packages > Add Package Dependency.

  2. 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.

  3. 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.

  4. Choose the AWSAppSync package product and click Finish.

  5. In your source file, import the SDK using import AWSAppSync.

Via CocoaPods

  1. Add the following line to your Podfile:

    ruby pod 'AWSAppSync', '~> 3.7.1'

    Example:

    ```ruby

    Uncomment the next line to define a global platform for your project

    platform :ios, '9.0'

    target 'EventsApp' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks!

    # Pods for EventsApp pod 'AWSAppSync', '~> 3.7.1' end ```

  2. Run pod install to install the AppSync SDK, then open the .xcworkspace file (not the .xcodeproj file) in Xcode.

  3. 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.

  4. In your source file, import the SDK using import AWSAppSync.

Via Carthage

XCFrameworks (recommended)

Carthage supports XCFrameworks in Xcode 12 or above. Follow the steps below to consume the AWS SDK for iOS using XCFrameworks:

  1. Install Carthage 0.37.0 or greater.

  2. Add the following to your Cartfile:

    github "awslabs/aws-mobile-appsync-sdk-ios"

  3. Then run the following command:

    $ carthage update --use-xcframeworks
    
  4. 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.

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. To use AWSMobileClient, import it as:

    import AWSMobileClientXCF

and use it your app code without the XCF suffix.

    AWSMobileClient.default.initialize()
Frameworks with "fat libraries" (not recommended)

To build platform-specific framework bundles with multiple architectures in the binary, (Xcode 11 and below)

  1. Add the following to your Cartfile:

    github "awslabs/aws-mobile-appsync-sdk-ios"

  2. 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.

  3. Choose the Add Other button, navigate to the AWS<#ServiceName#>.framework files under Carthage > Build > iOS and select AWSAppSync.framework and its required dependencies:

* AWSAppSync.framework
* AWSCore.framework
* Reachability.framework
* SQLite.framework
* AppSyncRealTimeClient.framework
* Starscream.framework

Do not select the `Destination: Copy items` if needed check box when prompted.
  1. 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.

    bash bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/AWSCore.framework/strip-frameworks.sh"

    Options:

    • Shell: /bin/sh
    • Show environment variables in build log: Checked
    • Run script only when installing: Not checked
    • Input Files: Empty
    • Output Files: Empty
  2. 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.

    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.

  3. In your source file, import the SDK using import AWSAppSync.

Codegen

To use the AppSync SDK, you will need to use amplify codegen from the AWS Amplify CLI. 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.

Sample

You can find a sample app which uses the AppSync SDK here: https://github.com/aws-samples/aws-mobile-appsync-events-starter-ios

Documentation

You 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

Contributing

Contributing guidelines are noted here.

Testing Contributions

If you are contributing to the SDK, it is recommended to add some unit and/or integration tests and evaluate against existing tests.

Invoking tests

The 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 > Test" (⌘-U) in Xcode.

To run only one suite of tests (Unit or Integration), select the appropriate target from the Scheme selector and invoke "Product > Test" (⌘-U). While Unit tests run much faster than Integration tests, we recommend running both before submitting a PR.

Setting up unit tests

Unit Tests do not require any specific setup and can be run directly from your Xcode IDE. - NOTE: Currently, any test that requires network activity is placed in Integration tests, even if the test hits localhost and not a valid service.

Setting up integration tests

To run integration tests, you will need the following: - Two AppSync API instances with an Posts schema. - The first AppSync instance should be configured to use a Cognito Identity Pool with unauthenticated identities supported. - The Cognito Identity Pool's unauth role should have the AppSync Invoke Full Access permission. - The second instance should be configured to use API Key authentication.

You can get the backend setup by following the steps below:

  1. Create a stack with an AppSync API using API Key authentication
    1. Go to the AWS CloudFormation console.
    2. 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
    3. Click Next
    4. Type a "Stack name" and a "ResourceNamePrefix"
      • We recommend using a "ResourceNamePrefix" that makes it easy to tell that the stack is used for AppSync tests, such as AppSyncTest<YYYYMMDDHHMM>.
      • 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<YYYYMMDDHHMM>-APIKey and AppSyncTest<YYYYMMDDHHMM>-IAM.
    5. Select the ApiKey Auth Type
    6. Once the stack is complete, click on the Output tab.
    7. Copy the appropriate values to the test configuration file AppSyncIntegrationTests/appsync_test_credentials.json:
      • AppSyncApiKey
      • AppSyncEndpointAPIKey
      • AppSyncEndpointAPIKeyRegion
  2. Create another CloudFormation Stack following steps 1-6 above, but select the "IAM" Auth Type in step 5.
    1. Copy the appropriate values to the test configuration file AppSyncIntegrationTests/appsync_test_credentials.json:
      • AppSyncEndpoint
      • AppSyncRegion
      • CognitoIdentityPoolId
      • CognitoIdentityPoolRegion
      • BucketName
      • BucketRegion
      • AppSyncMultiAuthAPIKey
  3. Create another CloudFormation Stack following step 1-6 above with API Key as the Auth type (we'll change that later)

    1. Create a Lambda function using the template provided in this project at AWSAppSyncIntegrationTests/ConsoleResources/appsync-lambda-authorize r.js
    2. Once the stack is complete click on the Outputs tab
    3. Copy the appropriate values to the test configuration file AppSyncIntegrationTests/appsync_test_credentials.json:
      • AppSyncEndpointAPIKeyLambda
      • AppSyncEndpointAPIKeyLambdaRegion
    4. Go to the AWS AppSync console, select the newly created AppSync instance
    5. In the Settings section, change the default authentication type to AWS Lambda and select the Lambda function created at the previous step

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.

Option 1: Use a test configuration file

Add 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:

json { "AppSyncEndpoint": "https://iambasedendpoint.appsync-api.us-east-1.amazonaws.com/graphql", "AppSyncRegion": "us-east-1", "CognitoIdentityPoolId": "us-east-1:abcd1234-1234-12324-b4b7-aaa0c0831234", "CognitoIdentityPoolRegion": "us-east-1", "AppSyncEndpointAPIKey": "https://apikeybasedendpoint.appsync-api.us-east-1.amazonaws.com/graphql", "AppSyncEndpointAPIKeyRegion": "us-east-1", "AppSyncAPIKey": "da2-sad3lkh23422", "BucketName": "bucketName", "BucketRegion": "us-east-1", "AppSyncMultiAuthAPIKey": "da2-sd34s5ffxz" }

Note: The AppSyncEndpointAPIKey endpoint uses API_KEY based auth, while AppSyncEndpoint uses the AWS_IAM based auth.

Option 2: Edit defaults in source code

Edit the file AWSAppSyncTestCommon/AppSyncClientTestConfigurationDefaults with appropriate values.

Now you should be able to run the integration tests by invoking "Product > Test" (⌘-U) in Xcode.

License

This library is licensed under the Amazon Software License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Issues event: 2
  • Watch event: 3
  • Delete event: 1
  • Issue comment event: 3
  • Push event: 1
  • Pull request review event: 2
  • Pull request event: 2
  • Fork event: 8
  • Create event: 1
Last Year
  • Issues event: 2
  • Watch event: 3
  • Delete event: 1
  • Issue comment event: 3
  • Push event: 1
  • Pull request review event: 2
  • Pull request event: 2
  • Fork event: 8
  • Create event: 1

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 473
  • Total Committers: 50
  • Avg Commits per committer: 9.46
  • Development Distribution Score (DDS): 0.753
Past Year
  • Commits: 6
  • Committers: 4
  • Avg Commits per committer: 1.5
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Tim Schmelter s****e@a****m 117
Rohan Dubal r****l@g****m 84
Michael Law 1****a 73
Rohan Dubal r****b@a****m 22
Jithin Roy 5****t 21
Diego Costantino d****o@a****m 18
Abhash Kumar Singh t****h@g****m 10
larryonoff l****f@g****m 10
dependabot[bot] 4****] 9
minbi m****i 8
Sebastian Villena 9****s 8
John Woo j****2@g****m 6
Mario Araujo m****o@e****m 5
Jacob Peddicord j****d 5
Harshdeep Singh 6****2 5
Frank Mueller f****e@a****m 4
cbommas c****m@a****m 4
Chunqiang SUN s****q@a****m 4
Di Wu g****b@w****e 4
Ian Saultz 5****n 4
Stefan Ceriu s****u@g****m 4
Karthikeyan Vasuki Balasubramaniam k****a@a****m 3
Chris Ameter 2****r 3
Daniel Farrelly j****y@j****m 3
Lachlan McCulloch l****h@g****m 3
Mário Araújo m****r@g****m 3
Roshan Kumar r****r@a****m 3
Tuan Pham 1****e 3
Karthikeyan k****b@u****u 2
Richard Threlkeld r****0@g****m 2
and 20 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 98
  • Total pull requests: 99
  • Average time to close issues: almost 3 years
  • Average time to close pull requests: 3 months
  • Total issue authors: 75
  • Total pull request authors: 26
  • Average comments per issue: 4.0
  • Average comments per pull request: 0.36
  • Merged pull requests: 82
  • Bot issues: 0
  • Bot pull requests: 7
Past Year
  • Issues: 3
  • Pull requests: 7
  • Average time to close issues: 29 days
  • Average time to close pull requests: 8 days
  • Issue authors: 3
  • Pull request authors: 4
  • Average comments per issue: 3.33
  • Average comments per pull request: 0.14
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • airstance (6)
  • larryonoff (4)
  • lawmicha (4)
  • achager (3)
  • palpatim (3)
  • amuresia (3)
  • zhouhao27 (2)
  • chajuss (2)
  • pokryfka (2)
  • desokroshan (2)
  • alionthego (2)
  • nandishyb (2)
  • AGoyal1980 (1)
  • brbatwork (1)
  • dhawalkp (1)
Pull Request Authors
  • lawmicha (21)
  • ruisebas (14)
  • thisisabhash (13)
  • diegocstn (11)
  • dependabot[bot] (8)
  • 5d (8)
  • royjit (6)
  • ameter (3)
  • palpatim (3)
  • phantumcode (3)
  • jellybeansoup (3)
  • atierian (3)
  • harsh62 (2)
  • brennanMKE (2)
  • rnapier (2)
Top Labels
Issue Labels
bug (26) feature-request (25) question (24) follow up (9) build (7) documentation (5) closing-soon-if-no-response (4) requesting info (4) pending-response (3) pending-release (3) pending triage (2) pending investigation (2) good first issue (2) Tests (1) complex object (1) open-for-contribution (1)
Pull Request Labels
dependencies (8) contribution (1)

Packages

  • Total packages: 2
  • Total downloads: unknown
  • Total dependent packages: 15
    (may contain duplicates)
  • Total dependent repositories: 39
    (may contain duplicates)
  • Total versions: 143
  • Total maintainers: 2
cocoapods.org: AWSAppSync

iOS client to access AWSAppSync backend.

  • Versions: 70
  • Dependent Packages: 15
  • Dependent Repositories: 39
Rankings
Dependent packages count: 0.5%
Dependent repos count: 1.4%
Forks count: 2.1%
Average: 2.2%
Stargazers count: 4.7%
Last synced: 6 months ago
swiftpackageindex.com: github.com/awslabs/aws-mobile-appsync-sdk-ios

iOS SDK for AWS AppSync.

  • Versions: 73
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 5.6%
Stargazers count: 15.2%
Average: 15.2%
Dependent packages count: 15.4%
Dependent repos count: 24.8%
Last synced: 6 months ago

Dependencies

Cartfile carthage
  • aws-amplify/aws-appsync-realtime-client-ios ~> 3.0.0
  • aws/aws-sdk-ios ~> 2.30.1
  • stephencelis/SQLite.swift ~> 0.12.2
AWSAppSync.podspec cocoapods
  • AWSCore ~> 2.30.1
  • AppSyncRealTimeClient ~> 3.0.0
  • ReachabilitySwift = 5.0.0
  • SQLite.swift ~> 0.12.2
Podfile cocoapods
  • AppSyncRealTimeClient ~> 3.0.0
  • SQLite.swift ~> 0.12.2
  • SwiftLint >= 0
Podfile.lock cocoapods
  • AWSAuthCore 2.30.1
  • AWSCognitoIdentityProvider 2.30.1
  • AWSCognitoIdentityProviderASF 2.30.1
  • AWSCore 2.30.1
  • AWSMobileClient 2.30.1
  • AWSS3 2.30.1
  • AppSyncRealTimeClient 3.0.0
  • SQLite.swift 0.12.2
  • Starscream 4.0.4
  • SwiftLint 0.50.3
Gemfile rubygems
  • cocoapods = 1.11.3
  • cocoapods-downloader = 1.6.3
Gemfile.lock rubygems
  • CFPropertyList 3.0.5
  • activesupport 6.1.7.2
  • addressable 2.8.0
  • algoliasearch 1.27.5
  • atomos 0.1.3
  • claide 1.1.0
  • cocoapods 1.11.3
  • cocoapods-core 1.11.3
  • cocoapods-deintegrate 1.0.5
  • cocoapods-downloader 1.6.3
  • cocoapods-plugins 1.0.0
  • cocoapods-search 1.0.1
  • cocoapods-trunk 1.6.0
  • cocoapods-try 1.2.0
  • colored2 3.1.2
  • concurrent-ruby 1.2.0
  • escape 0.0.4
  • ethon 0.15.0
  • ffi 1.15.5
  • fourflusher 2.3.1
  • fuzzy_match 2.0.4
  • gh_inspector 1.1.3
  • httpclient 2.8.3
  • i18n 1.12.0
  • json 2.6.1
  • minitest 5.17.0
  • molinillo 0.8.0
  • nanaimo 0.3.0
  • nap 1.1.0
  • netrc 0.11.0
  • public_suffix 4.0.6
  • rexml 3.2.5
  • ruby-macho 2.5.1
  • typhoeus 1.4.0
  • tzinfo 2.0.6
  • xcodeproj 1.21.0
  • zeitwerk 2.6.6
Package.resolved swiftpm
  • github.com/ashleymills/Reachability.swift 5.1.0
  • github.com/aws-amplify/aws-appsync-realtime-client-ios 3.0.0
  • github.com/aws-amplify/aws-sdk-ios-spm 2.30.1
  • github.com/daltoniam/Starscream 4.0.4
  • github.com/stephencelis/SQLite.swift 0.12.2
Package.swift swiftpm
.github/workflows/issue_closed.yml actions
  • actions/checkout b4ffde65f46336ab88eb53be808477a3936bae11 composite
  • aws-actions/closed-issue-message v1 composite
.github/workflows/issue_comment.yml actions
  • actions/checkout b4ffde65f46336ab88eb53be808477a3936bae11 composite
.github/workflows/issue_opened.yml actions
.github/workflows/notify_release.yml actions