AI prompts
base on A declarative library for application development using cloud services. ## Amplify Library for Swift
<img src="https://s3.amazonaws.com/aws-mobile-hub-images/aws-amplify-logo.png" alt="AWS Amplify" width="550" >
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](https://aws.amazon.com/sdk-for-swift/). This allows for access to the AWS SDK for Swift for a breadth of service-centric APIs.
[**API Documentation**](https://aws-amplify.github.io/amplify-swift/docs/)
[**Getting Started Guide**](https://docs.amplify.aws/start/q/integration/ios)
[![CI/CD](https://img.shields.io/github/actions/workflow/status/aws-amplify/amplify-swift/deploy_unstable.yml?logo=github&label=CI%2FCD)](https://github.com/aws-amplify/amplify-swift/actions/workflows/deploy_unstable.yml)
[![Codecov](https://img.shields.io/codecov/c/github/aws-amplify/amplify-swift?logo=codecov&label=codecov)](https://app.codecov.io/gh/aws-amplify/amplify-swift)
[![Discord](https://img.shields.io/discord/308323056592486420?logo=discord)](https://discord.gg/jWVbPfC)
## Features/APIs
- [Analytics](https://docs.amplify.aws/lib/analytics/getting-started/q/platform/ios) - for logging metrics and understanding your users.
- [API (GraphQL)](https://docs.amplify.aws/lib/graphqlapi/getting-started/q/platform/ios) - for adding a GraphQL endpoint to your app.
- [API (REST)](https://docs.amplify.aws/lib/restapi/getting-started/q/platform/ios) - for adding a REST endpoint to your app.
- [Authentication](https://docs.amplify.aws/lib/auth/getting-started/q/platform/ios) - for managing your users.
- [DataStore](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/ios) - for making it easier to program for a distributed data store for offline and online scenarios.
- [Geo](https://docs.amplify.aws/lib/geo/getting-started/q/platform/ios) - for adding location-based capabilities to your app.
- [Predictions](https://docs.amplify.aws/lib/predictions/getting-started/q/platform/ios/) - for connecting your app with machine learning services.
- [Push Notifications](https://docs.amplify.aws/lib/push-notifications/getting-started/q/platform/ios/) - for integrating push notifications in your app.
- [Storage](https://docs.amplify.aws/lib/storage/getting-started/q/platform/ios) - 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 | 9+ | GA |
| visionOS | 1+ | Preview* |
### Swift Version Support
The current minimum supported Swift language version is **Swift 5.9**.
> [!NOTE]
> The minimum Swift language version supported by Amplify Swift matches the version included in the minimum Xcode version allowed by Apple to upload apps to App Store Connect. Historically, Apple updates the minimum allowed Xcode version in April each year. You can expect Amplify Swift to update the minimum supported Swift version within the following 60 days. This is done to ensure Amplify Swift can provide modern Swift APIs and take advantage of Swift language improvements.
## Semantic versioning
We follow [semantic versioning](https://semver.org/) 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.
#### Semantic versioning and dependencies update
We follow [semantic versioning for updating our dependencies](https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api).
## License
This library is licensed under the Apache 2.0 License.
## Installation
Amplify requires Xcode 15.0 or later for all the supported platforms.
| For more detailed instructions, follow the getting started guides in our [documentation site](https://docs.amplify.aws/lib/q/platform/ios) |
|-------------------------------------------------|
### 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](readme-images/spm-setup-01-add-package.png)
1. Enter the Amplify Library for Swift GitHub repo URL (`https://github.com/aws-amplify/amplify-swift`) into the search bar.
1. 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](readme-images/spm-setup-02-amplify-repo-options.png)
1. 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](readme-images/spm-setup-03-select-dependencies.png)
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.
1. 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.
```swift
import Amplify
import AWSCognitoAuthPlugin
import AWSAPIPlugin
import AWSDataStorePlugin
// ...
func initializeAmplify() {
do {
try Amplify.add(plugin: AWSCognitoAuthPlugin())
try Amplify.add(plugin: AWSAPIPlugin())
try Amplify.add(plugin: 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:
```swift
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 sections**](#featuresapis) are supported via the [Swift SDK](https://github.com/awslabs/aws-sdk-swift) or if supported by a category can be accessed via the Escape Hatch like below:
```swift
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)")
}
```
## Describing use of required reason API
As required by the Apple App Store, we provide the new `PrivacyInfo.xcprivacy` file for describing use of required reason API, see [Describing use of required reason API
](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api). You can also export the privacy report after archiving your App in Xcode, see [Create your app’s privacy report](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests#4239187).
The following Amplify targets have been identified to be using the [User defaults APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api#4278401):
* `AWSCognitoAuthPlugin`
* `AWSDataStorePlugin`
* `AWSCloudWatchLoggingPlugin`
* `InternalAWSPinpoint`
## Reporting Bugs/Feature Requests
[![Open Bugs](https://img.shields.io/github/issues/aws-amplify/amplify-swift/bug?color=d73a4a&label=bugs)](https://github.com/aws-amplify/amplify-swift/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
[![Open Questions](https://img.shields.io/github/issues/aws-amplify/amplify-swift/question?color=558dfd&label=questions)](https://github.com/aws-amplify/amplify-swift/issues?q=is%3Aissue+label%3A%22question%22+is%3Aopen+)
[![Feature Requests](https://img.shields.io/github/issues/aws-amplify/amplify-swift/feature-request?color=ff9001&label=feature%20requests)](https://github.com/aws-amplify/amplify-swift/issues?q=is%3Aissue+label%3A%22feature-request%22+is%3Aopen+)
[![Closed Issues](https://img.shields.io/github/issues-closed/aws-amplify/amplify-swift?color=%2325CC00)](https://github.com/aws-amplify/amplify-swift/issues?q=is%3Aissue+is%3Aclosed+)
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check [existing open](https://github.com/aws-amplify/amplify-swift/issues), or [recently closed](https://github.com/aws-amplify/amplify-swift/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), 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](./CONTRIBUTING.md) before submitting any PR's. Thanks! ♥️
", Assign "at most 3 tags" to the expected json: {"id":"10764","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"