Code Monkey home page Code Monkey logo

aws-mobile-appsync-sdk-ios's Introduction

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 4.2. Use Xcode 10.0 or greater to build.

  • Consuming through cocoapods:
  1. Add the following line to your Podfile:

    pod 'AWSAppSync', '~> 2.6.24'
    

    Example:

    # 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', '~> 2.6.24'
    end
    
  2. Run pod install to install the AppSync SDK

  3. Now, open the .xcworkspace file and import the SDK using import AWSAppSync.

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://aws-amplify.github.io/docs/ios/api

Contributing

Contributing guidelines are noted here.

Testing Contributions

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

  • Unit Tests

    Unit Tests do not require any specific setup and can be run directly from your Xcode IDE.

  • Functional Tests

    For running functional tests, we will need the following:

    • An AppSync API with an Events App schema
    • A Cognito Identity Pool with unauthenticated identities supported
    • The Cognito Identity Pool's unauth role should have the AppSync Invoke Full Access permission

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

    • Go to AWS AppSync console.
    • Click on Create New API and then select Event App and hit Create, take a note of the API URL of the created API.
    • Once the creation completes, select Settings from left side of the console and then select AWS Identity and Access Management (IAM) as the authorization type.
    • Next, create a new Cognito Identity Pool and attach AppSync Invoke Full Access permission to the unauth role of the Identity Pool. Keep a note of the Identity Pool ID of newly created pool.
    • Create another AppSync API using the same steps above, but use API Key Auth mode instead which is available by default.

    Finally, you will need to setup a config file locally to access the server. Add a file appsync_test_credentials.json (see sample below) in the AWSAppSyncTests folder and replace the values for AppSyncEndpoint, CognitoIdentityPoolId, AppSyncEndpointAPIKey, AppSyncAPIKey and regions if required:

    {
      "AppSyncEndpoint": "https://asd32hl34523454532.appsync-api.us-east-1.amazonaws.com/graphql",
      "AppSyncRegion": "us-east-1",
      "CognitoIdentityPoolId": "us-east-1:abcas234-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"
    }

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

    Now you should be able to run the functional tests!

License

This library is licensed under the Amazon Software License.

aws-mobile-appsync-sdk-ios's People

Contributors

alexhmelevskiag avatar appwiz avatar choefele avatar desokroshan avatar frankmuellr avatar hyandell avatar ifabijanovic avatar joelmbell avatar johnrbk avatar jpeddicord avatar larryonoff avatar mariobajr avatar minbi avatar palpatim avatar prajaktatathavadkar avatar rohandubal avatar scb01 avatar stefanceriu avatar undefobj avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.