Skip to content

analystsfd/1501443poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amplify for iOS

AWS Amplify

AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. AWS Amplify goes well with any JavaScript based frontend workflow, and React Native for mobile developers.

Our default implementation works with Amazon Web Services (AWS), but AWS Amplify is designed to be open and pluggable for any custom backend or service.

Cocoapods CircleCI Discord

Features/APIs

  • Analytics - for logging metrics and understanding your users.
  • API (GraphQL) - for adding a GraphQL endpoint to your app.
  • API (REST) - for adding a REST endpoint to your app.
  • Authentication - for managing your users.
  • DataStore - for making it easier to program for a distributed data store for offline and online scenarios.
  • Geo - for adding location-based capabilities to your app.
  • Predictions - to detect text, images, and more!
  • Storage - store complex objects like pictures and videos to the cloud.

All services and features not listed above are supported via the iOS SDK or if supported by a category can be accessed via the Escape Hatch like below:

guard let predictionsPlugin = try Amplify.Predictions.getPlugin(for: "awsPredictionsPlugin") as? AWSPredictionsPlugin else {
    print("Unable to cast to AWSPredictionsPlugin")
    return
}

guard let rekognitionService = predictionsPlugin.getEscapeHatch(key: .rekognition) as? AWSRekognition else {
    print("Unable to get AWSRekognition")
    return
}

let request = AWSRekognitionCreateCollectionRequest()
if let request = request {
    rekognitionService.createCollection(request)
}

Platform Support

Amplify supports iOS 11 and above and iOS 13 for certain categories such as Predictions and Geo. There are currently no plans to support Amplify on WatchOS, tvOS, or MacOS.

License

This library is licensed under the Apache 2.0 License.

Installation

Amplify requires Xcode 11.4 or higher to build.

For more detailed instructions, follow the getting started guides in our documentation site

Swift Package Manager

  1. Swift Package Manager is distributed with Xcode. To start adding the Amplify Libraries to your iOS project, open your project in Xcode and select File > Swift Packages > Add Package Dependency.

    Add package dependency

  2. Enter the Amplify iOS GitHub repo URL (https://github.com/aws-amplify/amplify-ios) into the search bar and click Next.

    Search for repo

  3. You'll see the Amplify iOS repository rules for which version of Amplify you want Swift Package Manager to install. Choose the first rule, Version, as it will use the latest compatible version of the dependency that can be detected from the main branch, then click Next.

    Dependency version options

  4. Choose which of the libraries you want added to your project. Always select the Amplify library. The "Plugin" to install depends on which categories you are using:

    • API: AWSAPIPlugin

    • Analytics: AWSPinpointAnalyticsPlugin

    • Auth: AWSCognitoAuthPlugin

    • DataStore: AWSDataStorePlugin

    • Storage: AWSS3StoragePlugin

      Note: AWSPredictionsPlugin is not currently supported through Swift Package Manager due to different minimum iOS version requirements. Support for this will eventually be added.

    Select dependencies

    Select all that are appropriate, then click Finish.

    You can always go back and modify which SPM packages are included in your project by opening the Swift Packages tab for your project: Click on the Project file in the Xcode navigator, then click on your project's icon, then select the Swift Packages tab.

  5. In your app code, explicitly import a plugin when you need to add a plugin to Amplify, access plugin options, or access a category escape hatch.

    import Amplify
    import AWSAPIPlugin
    import AWSDataStorePlugin
    
    // ... later
    
    func initializeAmplify() {
        do {
            try Amplify.add(AWSAPIPlugin())
            // and so on ...
        } catch {
            assert(false, "Error initializing Amplify: \(error)")
        }
    }

    If you're just accessing Amplify category APIs (e.g., Auth.signIn() or Storage.uploadFile()), you only need to import Amplify:

    import Amplify
    
    // ... later
    
    func doUpload() {
        Amplify.Storage.uploadFile(...)
    }

CocoaPods

  1. Amplify for iOS is available through CocoaPods. If you have not installed CocoaPods, install CocoaPods by running the command:

    $ gem install cocoapods
    $ pod setup
    

    Depending on your system settings, you may have to use sudo for installing cocoapods as follows:

    $ sudo gem install cocoapods
    $ pod setup
    
  2. In your project directory (the directory where your *.xcodeproj file is), type pod init and open the Podfile that was created. Add the Amplify pod and any plugins you would like to use. Below is an example of what a podfile might look like if you were going to use the Predictions plugin.

    source 'https://github.com/CocoaPods/Specs.git'
    
    platform :ios, '13.0'
    use_frameworks!
    
    target :'YourTarget' do
        pod 'Amplify'
        pod 'AmplifyPlugins/AWSCognitoAuthPlugin'
        pod 'AWSPredictionsPlugin'
        pod 'CoreMLPredictionsPlugin'
    end
  3. Then run the following command:

    $ pod install
    
  4. Open up *.xcworkspace with Xcode and start using Amplify.

    image

    Note: Do NOT use *.xcodeproj. If you open up a project file instead of a workspace, you will receive an error.

  5. In your app code, import AmplifyPlugins when you need to add a plugin to Amplify, access plugin options, or access a category escape hatch.

    import Amplify
    import AmplifyPlugins
    
    // ... later
    
    func initializeAmplify() {
        do {
            try Amplify.add(AWSAPIPlugin())
            // and so on ...
        } catch {
            assert(false, "Error initializing Amplify: \(error)")
        }
    }

    If you're just accessing Amplify category APIs (e.g., Auth.signIn() or Storage.uploadFile()), you only need to import Amplify:

    import Amplify
    
    // ... later
    
    func doUpload() {
        Amplify.Storage.uploadFile(...)
    }

Development Pods

You can manually install the library by cloning this repo and creating a Podfile that references your local clone of it like below:

pod 'Amplify', :path => '~/amplify-ios'
pod 'AWSPluginsCore', :path => '~/amplify-ios'
pod 'CoreMLPredictionsPlugin', :path => '~/amplify-ios'
pod 'AWSPredictionsPlugin', :path => '~/amplify-ios'
pod 'AmplifyPlugins/AWSAPIPlugin', :path => '~/amplify-ios'

Then, install the dependencies:

pod install

Open your project using ./YOUR-PROJECT-NAME.xcworkspace file. Remember to always use ./YOUR-PROJECT-NAME.xcworkspace to open your Xcode project from now on.

Reporting Bugs/Feature Requests

Open Bugs Open Questions Feature Requests Closed Issues

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

  • Expected behavior and observed behavior
  • A reproducible test case or series of steps
  • The version of our code being used
  • Any modifications you've made relevant to the bug
  • Anything custom about your environment or deployment

Open Source Contributions

We welcome any and all contributions from the community! Make sure you read through our contribution guide here before submitting any PR's. Thanks! ♥️

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages