• Stars
    star
    423
  • Rank 100,260 (Top 3 %)
  • Language
    Swift
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A declarative library for application development using cloud services.

Amplify Library for Swift

AWS Amplify

AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. 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.

The Amplify Library for Swift is layered on the AWS SDK for Swift, which was released as Developer Preview last year. This allows for access to the AWS SDK for Swift for a breadth of service-centric APIs.

API Documentation

Getting Started Guide

CI/CD Codecov 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 - for connecting your app with machine learning services.
  • Push Notifications - for integrating push notifications in your app.
  • Storage - store complex objects like pictures and videos to the cloud.

Platform Support

Platform Versions Support Level
iOS 13+ GA
macOS 10.15+ GA
tvOS 13+ GA
watchOS 7+ GA
visionOS 1+ Preview*

To use Amplify Swift with visionOS, you'll need to target the visionos-preview branch. For more information, see Platform Support on the visionos-preview branch.

Semantic versioning

We follow semantic versioning for our releases.

Semantic versioning and enumeration cases

When Amplify adds a new enumeration value, we will publish a new minor version of the library.

Applications that evaluate all members of an enumeration using a switch statement can add a default case to prevent new cases from causing compile warnings or errors.

License

This library is licensed under the Apache 2.0 License.

Installation

Amplify requires Xcode 14.1 or higher to build for iOS and macOS. Building for watchOS and tvOS requires Xcode 14.3 or higher.

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 > Add Packages.

    Add package dependency

  2. Enter the Amplify Library for Swift GitHub repo URL (https://github.com/aws-amplify/amplify-swift) into the search bar.

  3. You'll see the Amplify Library for Swift repository rules for which version of Amplify you want Swift Package Manager to install. Choose Up to Next Major Version and enter 2.0.0 as the minimum version for the Dependency Rule, then click Add Package.

    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
    • Geo: AWSLocationGeoPlugin
    • Storage: AWSS3StoragePlugin

    Select dependencies

    Select all that are appropriate, then click Add Package.

    You can always go back and modify which SPM packages are included in your project by opening the Package Dependencies tab for your project: Click on the Project file in the Xcode navigator, then click on your project under the Project section, then select the Package Dependencies 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 AWSCongitoAuthPlugin
    import AWSAPIPlugin
    import AWSDataStorePlugin
    
    // ...
    
    func initializeAmplify() {
        do {
            try Amplify.add(AWSCognitoAuthPlugin())
            try Amplify.add(AWSAPIPlugin())
            try Amplify.add(AWSDataStorePlugin())
            // and so on ...
            try Amplify.configure()
        } catch {
            assertionFailure("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
    
    // ...
    
    func signIn() async throws {
        let signInResult = try await Amplify.Auth.signIn(...)
        // ...
    }

Escape Hatch

All services and features not listed in the Features/API sectios are supported via the Swift SDK or if supported by a category can be accessed via the Escape Hatch like below:

import Amplify
import AWSS3StoragePlugin
import AWSS3

// ...

guard let plugin = try Amplify.Storage.getPlugin(for: "awsS3StoragePlugin") as? AWSS3StoragePlugin else {
    print("Unable to to cast to AWSS3StoragePlugin")
    return
}

let awsS3 = plugin.getEscapeHatch()

let accelerateConfigInput = PutBucketAccelerateConfigurationInput()
do {
    let accelerateConfigOutput = try await awsS3.putBucketAccelerateConfiguration(
        input: accelerateConfigInput
    )
    print("putBucketAccelerateConfiguration output: \(accelerateConfigOutput)")
} catch {
    print("putBucketAccelerateConfiguration error: \(error)")
}

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! ♥️

More Repositories

1

amplify-js

A declarative JavaScript library for application development using cloud services.
TypeScript
9,360
star
2

amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
TypeScript
2,783
star
3

aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
Objective-C
1,657
star
4

amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
Dart
1,282
star
5

aws-sdk-android

AWS SDK for Android. For more information, see our web site:
Java
1,009
star
6

amplify-ui

Amplify UI is a collection of accessible, themeable, performant React (and more!) components that can connect directly to the cloud.
TypeScript
759
star
7

docs

AWS Amplify Framework Documentation
MDX
471
star
8

amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
Dockerfile
439
star
9

learn

AWS Amplify Learn
JavaScript
257
star
10

amplify-android

The fastest and easiest way to use AWS from your Android app.
Java
227
star
11

amplify-studio

AWS Amplify Studio (Formerly Admin UI)
131
star
12

amplify-js-samples

A Sample Repository for Amplify JS Samples
116
star
13

amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
TypeScript
102
star
14

amplify-category-api

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
TypeScript
74
star
15

amplify-codegen

Amplify Codegen is a JavaScript toolkit library for frontend and mobile developers building Amplify applications.
TypeScript
58
star
16

amplify-codegen-ui

Generate React components for use in an AWS Amplify project.
TypeScript
30
star
17

aws-sdk-ios-spm

This repository enables Swift Package Manager support for the AWS Mobile SDK for iOS
Swift
28
star
18

discord-bot

Discord bot for the AWS Amplify Discord Server
TypeScript
24
star
19

amplify-ios-samples

Swift
22
star
20

aws-amplify.github.io

Amplify Framework Website
HTML
20
star
21

aws-appsync-realtime-client-ios

A client implementation in Swift for the AWS AppSync service on the iOS platform.
Swift
16
star
22

amplify-ci-support

Scripts and tools for managing Amplify projects in continuous integration environments, and for local developer setup of integration test environments.
Python
16
star
23

maplibre-gl-js-amplify

TypeScript
13
star
24

maplibre-gl-draw-circle

Supports drawing/editing a circle on a Mapbox map.
JavaScript
12
star
25

amplify-cli-export-construct

TypeScript
11
star
26

amplify-ui-swift-authenticator

The Amplify UI Authenticator is a component that supports several authentiation flows using Amplify Authentication.
Swift
11
star
27

amplify-ui-android

Amplify UI for Android is a collection of accessible, themeable, performant Android components that can connect directly to the cloud.
Kotlin
9
star
28

amplify-ui-swift-liveness

This repository offers a UI component for Amazon Rekognition Face Liveness, enabling developers to ensure that only authentic users, and not bad actors using spoofs, can access their services.
Swift
8
star
29

amplify-android-samples

Samples for testing out Amplify Android libraries
Kotlin
6
star
30

amplify-ios-maplibre

An adapter to leverage Amplify Geo with the map rendering of MapLibre.
Swift
4
star
31

amplify-swift-utils-notifications

This repository serves as a dependency package for amplify-swift, providing valuable functionalities to handle push notifications on iOS and macOS platforms.
Swift
4
star
32

amplify-swift-plugin-toolkit

A toolkit for developing Swift Plugins for Amplify.
Swift
1
star